Browse Source

esp_http_client: Fix redirect by resetting auth_header before parsing

Harshit Malpani 3 năm trước cách đây
mục cha
commit
437d90c408
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      components/esp_http_client/esp_http_client.c

+ 4 - 0
components/esp_http_client/esp_http_client.c

@@ -522,6 +522,10 @@ static esp_err_t esp_http_client_prepare(esp_http_client_handle_t client)
         free(client->location);
         client->location = NULL;
     }
+    if (client->auth_header != NULL) {
+        free(client->auth_header);
+        client->auth_header = NULL;
+    }
     http_parser_init(client->parser, HTTP_RESPONSE);
     if (client->connection_info.username) {
         char *auth_response = NULL;