From bbd57a220478c5b7f58e8eb435d2a531ec51f1dc Mon Sep 17 00:00:00 2001 From: Mathew Harman Date: Thu, 3 Apr 2025 15:57:04 -0400 Subject: [PATCH] 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. --- 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 ef5130ec20..96fb635fcc 100644 --- a/components/esp_http_client/esp_http_client.c +++ b/components/esp_http_client/esp_http_client.c @@ -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) { - 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; }