Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_http_client_async_mode_v5.1' into 'release/v…
Browse files Browse the repository at this point in the history
…5.1'

fix(esp_http_client): Fix esp_http_client async mode (v5.1)

See merge request espressif/esp-idf!27514
  • Loading branch information
mahavirj committed Dec 8, 2023
2 parents 54f2536 + 19355c0 commit d15ef87
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/esp_http_client/esp_http_client.c
Expand Up @@ -1110,7 +1110,12 @@ static int esp_http_client_get_data(esp_http_client_handle_t client)

int rlen = esp_transport_read(client->transport, res_buffer->data, client->buffer_size_rx, client->timeout_ms);
if (rlen >= 0) {
http_parser_execute(client->parser, client->parser_settings, res_buffer->data, rlen);
// When tls error is ESP_TLS_ERR_SSL_WANT_READ (-0x6900), esp_trasnport_read returns ERR_TCP_TRANSPORT_CONNECTION_TIMEOUT (0x0).
// We should not execute http_parser_execute() on this condition as it sets the internal state machine in an
// invalid state.
if (!(client->is_async && rlen == 0)) {
http_parser_execute(client->parser, client->parser_settings, res_buffer->data, rlen);
}
}
return rlen;
}
Expand Down

0 comments on commit d15ef87

Please sign in to comment.