From 2e3f06ece8bffeda95ab9546d4356ed4d4b72ca8 Mon Sep 17 00:00:00 2001 From: Jitin George Date: Mon, 24 Dec 2018 10:52:38 +0530 Subject: [PATCH 1/3] esp_http_client: Fix for setting incorrect post header length Closes https://github.com/espressif/esp-idf/issues/2638 --- components/esp_http_client/esp_http_client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/esp_http_client/esp_http_client.c b/components/esp_http_client/esp_http_client.c index 81e54b7e0..4a82a50e3 100644 --- a/components/esp_http_client/esp_http_client.c +++ b/components/esp_http_client/esp_http_client.c @@ -166,7 +166,7 @@ enum HttpStatus_Code }; -static esp_err_t esp_http_client_request_send(esp_http_client_handle_t client); +static esp_err_t esp_http_client_request_send(esp_http_client_handle_t client, int write_len); static esp_err_t esp_http_client_connect(esp_http_client_handle_t client); static esp_err_t esp_http_client_send_post_data(esp_http_client_handle_t client); @@ -817,7 +817,7 @@ esp_err_t esp_http_client_perform(esp_http_client_handle_t client) } /* falls through */ case HTTP_STATE_CONNECTED: - if ((err = esp_http_client_request_send(client)) != ESP_OK) { + if ((err = esp_http_client_request_send(client, client->post_len)) != ESP_OK) { if (client->is_async && errno == EAGAIN) { return ESP_ERR_HTTP_EAGAIN; } @@ -997,11 +997,11 @@ static int http_client_prepare_first_line(esp_http_client_handle_t client, int w return first_line_len; } -static esp_err_t esp_http_client_request_send(esp_http_client_handle_t client) +static esp_err_t esp_http_client_request_send(esp_http_client_handle_t client, int write_len) { int first_line_len = 0; if (!client->first_line_prepared) { - if ((first_line_len = http_client_prepare_first_line(client, client->post_len)) < 0) { + if ((first_line_len = http_client_prepare_first_line(client, write_len)) < 0) { return first_line_len; } client->first_line_prepared = true; @@ -1092,7 +1092,7 @@ esp_err_t esp_http_client_open(esp_http_client_handle_t client, int write_len) if ((err = esp_http_client_connect(client)) != ESP_OK) { return err; } - if ((err = esp_http_client_request_send(client)) != ESP_OK) { + if ((err = esp_http_client_request_send(client, write_len)) != ESP_OK) { return err; } return ESP_OK; From 582bf1878983b45e96d690a253d665a590b06266 Mon Sep 17 00:00:00 2001 From: Jitin George Date: Mon, 24 Dec 2018 10:56:08 +0530 Subject: [PATCH 2/3] tcp_transport: Fix incorrect error logging in ssl_read and ssl_write APIs Closes https://github.com/espressif/esp-idf/issues/2805 --- components/tcp_transport/transport_ssl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/tcp_transport/transport_ssl.c b/components/tcp_transport/transport_ssl.c index f2d346720..436f8a943 100644 --- a/components/tcp_transport/transport_ssl.c +++ b/components/tcp_transport/transport_ssl.c @@ -110,7 +110,7 @@ static int ssl_write(esp_transport_handle_t t, const char *buffer, int len, int return poll; } ret = esp_tls_conn_write(ssl->tls, (const unsigned char *) buffer, len); - if (ret <= 0) { + if (ret < 0) { ESP_LOGE(TAG, "esp_tls_conn_write error, errno=%s", strerror(errno)); } return ret; @@ -127,7 +127,7 @@ static int ssl_read(esp_transport_handle_t t, char *buffer, int len, int timeout } } ret = esp_tls_conn_read(ssl->tls, (unsigned char *)buffer, len); - if (ret <= 0) { + if (ret < 0) { ESP_LOGE(TAG, "esp_tls_conn_read error, errno=%s", strerror(errno)); } return ret; From 4f9a4e8ed738ac78ff54d4cd16157efb9d0327bc Mon Sep 17 00:00:00 2001 From: Jitin George Date: Mon, 24 Dec 2018 11:00:45 +0530 Subject: [PATCH 3/3] examples/simple_ota_example: Fix incorrect component reference in README --- examples/system/ota/simple_ota_example/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/system/ota/simple_ota_example/README.md b/examples/system/ota/simple_ota_example/README.md index 437964f74..a2629e100 100644 --- a/examples/system/ota/simple_ota_example/README.md +++ b/examples/system/ota/simple_ota_example/README.md @@ -1,7 +1,7 @@ # Simple OTA example -This example is based on `http_firmware_upgrade` component's APIs. +This example is based on `esp_https_ota` component's APIs. ## Configuration -Refer README.md in the parent directory for setup details \ No newline at end of file +Refer README.md in the parent directory for setup details