forked from espressif/esp-idf
fix(esp_http_client): fix error return when set_header has value==NULL
Prior to v5.4, headers could be deleted from an HTTP client by calling esp_http_client_set_header("Header", NULL). This pattern is used by esp_http_client_set_post_field(NULL, 0), which is the only API usage that will delete the request body in a persistent connection scenario.
This commit is contained in:
@@ -357,7 +357,7 @@ static int http_on_chunk_header(http_parser *parser)
|
|||||||
|
|
||||||
esp_err_t esp_http_client_set_header(esp_http_client_handle_t client, const char *key, const char *value)
|
esp_err_t esp_http_client_set_header(esp_http_client_handle_t client, const char *key, const char *value)
|
||||||
{
|
{
|
||||||
if (client == NULL || client->request == NULL || client->request->headers == NULL || key == NULL || value == NULL) {
|
if (client == NULL || client->request == NULL || client->request->headers == NULL || key == NULL) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user