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_ {
61
61
} http_request_context_t ;
62
62
63
63
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" ;
65
65
static uint32_t request_nr ;
66
66
67
67
@@ -386,12 +386,13 @@ static http_err_t https_create_context_for_request(http_request_context_t **http
386
386
ctx -> request = httpRequest ;
387
387
388
388
// 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
+
392
393
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
+
395
396
if (!ctx -> tls_request_buffer ) {
396
397
ESP_LOGE (TAG , "https_create_context_for_request: failed to allocate TLS request buffer" );
397
398
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)
178
178
xEventGroupClearBits (wifi_sta_event_group , WIFI_STA_EVENT_GROUP_CONNECTED_FLAG );
179
179
}
180
180
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" );
182
182
}
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