http examples: don't write NULs to sockets

Thanks @pfalcon for the heads-up.
This commit is contained in:
Angus Gratton 2015-06-09 09:03:56 +10:00
parent c09167715e
commit 6a5866aa55
2 changed files with 2 additions and 2 deletions

View file

@ -78,7 +78,7 @@ void http_get_task(void *pvParameters)
"GET "WEB_URL"\r\n" "GET "WEB_URL"\r\n"
"User-Agent: esp-open-rtos/0.1 esp8266\r\n" "User-Agent: esp-open-rtos/0.1 esp8266\r\n"
"\r\n"; "\r\n";
if (write(s, req, strlen(req) + 1) < 0) { if (write(s, req, strlen(req)) < 0) {
printf("... socket send failed\r\n"); printf("... socket send failed\r\n");
close(s); close(s);
vTaskDelay(4000 / portTICK_RATE_MS); vTaskDelay(4000 / portTICK_RATE_MS);

View file

@ -119,7 +119,7 @@ void http_get_task(void *pvParameters)
"GET "WEB_URL"\r\n" "GET "WEB_URL"\r\n"
"User-Agent: esp-open-rtos/0.1 esp8266\r\n" "User-Agent: esp-open-rtos/0.1 esp8266\r\n"
"\r\n"; "\r\n";
if (ssl_write(ssl, (uint8_t *)req, strlen(req) + 1) < 0) { if (ssl_write(ssl, (uint8_t *)req, strlen(req)) < 0) {
printf("... socket send failed\r\n"); printf("... socket send failed\r\n");
ssl_free(ssl); ssl_free(ssl);
close(s); close(s);