|
38 | 38 |
|
39 | 39 | #define DEFAULT_PORT 443 |
40 | 40 |
|
| 41 | +static const char kHttpGetMsg[] = "GET /index.html HTTP/1.0\r\n\r\n"; |
41 | 42 |
|
42 | 43 | int main(int argc, char** argv) |
43 | 44 | { |
@@ -133,17 +134,18 @@ int main(int argc, char** argv) |
133 | 134 | goto cleanup; |
134 | 135 | } |
135 | 136 |
|
136 | | - /* Get a message for the server from stdin */ |
137 | | - printf("Message for server: "); |
| 137 | + /* Initialize the buff */ |
138 | 138 | memset(buff, 0, sizeof(buff)); |
139 | | - if (fgets(buff, sizeof(buff), stdin) == NULL) { |
140 | | - fprintf(stderr, "ERROR: failed to get message for server\n"); |
141 | | - ret = -1; |
142 | | - goto cleanup; |
143 | | - } |
| 139 | + |
| 140 | + /* Copy HTTP GET request to the buff*/ |
| 141 | + memcpy(buff,kHttpGetMsg,sizeof(kHttpGetMsg)); |
| 142 | + |
| 143 | + /* Buff length */ |
144 | 144 | len = strnlen(buff, sizeof(buff)); |
145 | 145 |
|
146 | | - /* Send the message to the server */ |
| 146 | + /* Send HTTP GET request to the server */ |
| 147 | + printf("Sending HTTP GET request ...\n"); |
| 148 | + |
147 | 149 | if ((ret = wolfSSL_write(ssl, buff, len)) != len) { |
148 | 150 | fprintf(stderr, "ERROR: failed to write entire message\n"); |
149 | 151 | fprintf(stderr, "%d bytes of %d bytes were sent", ret, (int) len); |
|
0 commit comments