From 049c9f7beaf687dabed24b8a1f7e9be4ecdfb5bf Mon Sep 17 00:00:00 2001 From: Damian Reboredo Date: Tue, 9 Oct 2018 08:55:19 -0300 Subject: [PATCH] esp_http_client: Fix infinite loop on esp_http_client_fetch_headers error must also be returned if esp_tls_conn_read return 0 because socket was closed Merges https://github.com/espressif/esp-idf/pull/2534 --- components/esp_http_client/esp_http_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_http_client/esp_http_client.c b/components/esp_http_client/esp_http_client.c index 81e54b7e06..6a0580deef 100644 --- a/components/esp_http_client/esp_http_client.c +++ b/components/esp_http_client/esp_http_client.c @@ -894,7 +894,7 @@ int esp_http_client_fetch_headers(esp_http_client_handle_t client) while (client->state < HTTP_STATE_RES_COMPLETE_HEADER) { buffer->len = esp_transport_read(client->transport, buffer->data, client->buffer_size, client->timeout_ms); - if (buffer->len < 0) { + if (buffer->len <= 0) { return ESP_FAIL; } http_parser_execute(client->parser, client->parser_settings, buffer->data, buffer->len); -- 2.40.0