From 1dc3ae6e4e2dc79bc4189c5af73f774fa833244b Mon Sep 17 00:00:00 2001 From: Malte Janduda Date: Fri, 7 Apr 2017 11:56:13 +0200 Subject: [PATCH] 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 130729f06f..ebf7781548 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) {