소스 검색

Merge branch 'bugfix/http_request_example' into 'master'

Fix issues with HTTP[S] request examples

This MR includes:

- request string fix for the http_request example (https://github.com/espressif/esp-idf/pull/500)
- same fix applied to the https_request example
- stack size increase for http_request example

Fixes https://www.esp32.com/viewtopic.php?f=13&t=1620

See merge request !646

Ivan Grokhotkov 8 년 전
부모
커밋
8bc153e142

+ 5 - 5
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)
 {
@@ -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);
 }

+ 4 - 4
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