From 3c59f9e682ce3009e7ffc9000728e8cd5945c8b8 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 4687c07424..31b0f44f42 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; }