esp_http_client.c: In esp_http_client_read, add fix to return (-1) if esp_transport_read fails

This commit is contained in:
Shubham Kulkarni 2020-03-30 11:51:23 +05:30
parent a4fe300cc9
commit 22926742be
1 changed files with 5 additions and 1 deletions

View File

@ -854,7 +854,11 @@ int esp_http_client_read(esp_http_client_handle_t client, char *buffer, int len)
}
ESP_LOG_LEVEL(sev, TAG, "esp_transport_read returned:%d and errno:%d ", rlen, errno);
}
return ridx;
if (rlen < 0 && ridx == 0) {
return ESP_FAIL;
} else {
return ridx;
}
}
res_buffer->output_ptr = buffer + ridx;
http_parser_execute(client->parser, client->parser_settings, res_buffer->data, rlen);