File tree Expand file tree Collapse file tree 4 files changed +434
-95
lines changed Expand file tree Collapse file tree 4 files changed +434
-95
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ typedef struct http_request_context_ {
6161} http_request_context_t ;
6262
6363
64- static const char * http_get_request_format_string = "GET %s HTTP/1.1\nHost: %s\n \n" ;
64+ static const char * http_get_request_format_string = "GET %s HTTP/1.1\r\ nHost: %s\r\n\r \n" ;
6565static uint32_t request_nr ;
6666
6767
@@ -386,12 +386,13 @@ static http_err_t https_create_context_for_request(http_request_context_t **http
386386 ctx -> request = httpRequest ;
387387
388388 // Create the TLS request string.
389-
390- size_t requestLen = strlen (http_get_request_format_string ) + strlen (httpRequest -> host ) + strlen (httpRequest -> path ) - 4 + 1 ;
391-
389+
390+ size_t requestLen = strlen (http_get_request_format_string ) - 4 // strlen("%s%s") = 4
391+ + strlen (httpRequest -> host ) + strlen (httpRequest -> path );
392+
392393 ctx -> tls_request_buffer_size = requestLen ;
393- ctx -> tls_request_buffer = malloc (requestLen );
394-
394+ ctx -> tls_request_buffer = malloc (ctx -> tls_request_buffer_size * sizeof ( char ) );
395+
395396 if (!ctx -> tls_request_buffer ) {
396397 ESP_LOGE (TAG , "https_create_context_for_request: failed to allocate TLS request buffer" );
397398 https_destroy_context (ctx );
Original file line number Diff line number Diff line change @@ -178,5 +178,5 @@ static void wifi_sta_set_connected(bool c)
178178 xEventGroupClearBits (wifi_sta_event_group , WIFI_STA_EVENT_GROUP_CONNECTED_FLAG );
179179 }
180180
181- ESP_LOGI (TAG , "Device is now %s WIFI network" , c ? "connected to" : "disconnected from" )
181+ ESP_LOGI (TAG , "Device is now %s WIFI network" , c ? "connected to" : "disconnected from" );
182182}
Original file line number Diff line number Diff line change 1+ FILE=/esp32/esp32-ota-https.bin
2+ VERSION=1
3+ INTERVAL=10
You can’t perform that action at this time.
0 commit comments