From 1dc3ae6e4e2dc79bc4189c5af73f774fa833244b Mon Sep 17 00:00:00 2001 From: Malte Janduda Date: Fri, 7 Apr 2017 11:56:13 +0200 Subject: [PATCH 1/3] fixing http_request_example request content request new lines must be `\r\n` as specified in the HTTP RFC. Also the following logic checks for the socket to be closed by the server. This only happens with HTTP/1.0 not HTTP/1.1. So I have adjusted the protocol in the request, too. --- .../http_request/main/http_request_example_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/protocols/http_request/main/http_request_example_main.c b/examples/protocols/http_request/main/http_request_example_main.c index 130729f06..ebf778154 100644 --- a/examples/protocols/http_request/main/http_request_example_main.c +++ b/examples/protocols/http_request/main/http_request_example_main.c @@ -46,10 +46,10 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "example"; -static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" - "Host: "WEB_SERVER"\n" - "User-Agent: esp-idf/1.0 esp32\n" - "\n"; +static const char *REQUEST = "GET " WEB_URL " HTTP/1.0\r\n" + "Host: "WEB_SERVER"\r\n" + "User-Agent: esp-idf/1.0 esp32\r\n" + "\r\n"; static esp_err_t event_handler(void *ctx, system_event_t *event) { From 6b94c32cd648cb2fc7186eccc7965fd3f58f783a Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 11 Apr 2017 18:37:16 +0800 Subject: [PATCH 2/3] examples: fix https_request request content Same as 727d884, but for https_request example --- .../https_request/main/https_request_example_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/protocols/https_request/main/https_request_example_main.c b/examples/protocols/https_request/main/https_request_example_main.c index 305b56220..bbba44983 100644 --- a/examples/protocols/https_request/main/https_request_example_main.c +++ b/examples/protocols/https_request/main/https_request_example_main.c @@ -71,10 +71,10 @@ const int CONNECTED_BIT = BIT0; static const char *TAG = "example"; -static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n" - "Host: "WEB_SERVER"\n" - "User-Agent: esp-idf/1.0 esp32\n" - "\n"; +static const char *REQUEST = "GET " WEB_URL " HTTP/1.0\r\n" + "Host: "WEB_SERVER"\r\n" + "User-Agent: esp-idf/1.0 esp32\r\n" + "\r\n"; /* Root cert for howsmyssl.com, taken from server_root_cert.pem From 041754f25565a8247875bdf8a0a27b1579edffc4 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 11 Apr 2017 18:38:50 +0800 Subject: [PATCH 3/3] examples: increase stack size in http_request Previously the stack size was 2048 bytes, which caused stack overflow to be detected after one or two runs of the example. --- .../protocols/http_request/main/http_request_example_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/protocols/http_request/main/http_request_example_main.c b/examples/protocols/http_request/main/http_request_example_main.c index ebf778154..be3bb9e36 100644 --- a/examples/protocols/http_request/main/http_request_example_main.c +++ b/examples/protocols/http_request/main/http_request_example_main.c @@ -176,5 +176,5 @@ void app_main() { ESP_ERROR_CHECK( nvs_flash_init() ); initialise_wifi(); - xTaskCreate(&http_get_task, "http_get_task", 2048, NULL, 5, NULL); + xTaskCreate(&http_get_task, "http_get_task", 4096, NULL, 5, NULL); }