Skip to content

Commit e64183a

Browse files
authored
Merge pull request #7 from bassjansson/PR
Updates to current ESP32 libraries together with some bug fixes.
2 parents 8258c07 + 63e3112 commit e64183a

File tree

4 files changed

+434
-95
lines changed

4 files changed

+434
-95
lines changed

main/https_client.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff 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";
6565
static 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);

main/wifi_sta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

meta/ota.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FILE=/esp32/esp32-ota-https.bin
2+
VERSION=1
3+
INTERVAL=10

0 commit comments

Comments
 (0)