Merge branch 'fix/esp_http_client_fix_behavior_disable_auto_redirect_enabled' into 'master'

fix: esp_http_client fix behaviour when disable_auto_redirect is enabled

Closes IDF-6136

See merge request espressif/esp-idf!20805
This commit is contained in:
Mahavir Jain 2022-11-04 20:38:24 +08:00
commit 960a84db47
2 changed files with 3 additions and 1 deletions

View File

@ -851,8 +851,9 @@ static esp_err_t esp_http_check_response(esp_http_client_handle_t client)
case HttpStatus_PermanentRedirect:
if (client->disable_auto_redirect) {
http_dispatch_event(client, HTTP_EVENT_REDIRECT, NULL, 0);
} else {
ESP_ERROR_CHECK(esp_http_client_set_redirection(client));
}
esp_http_client_set_redirection(client);
client->redirect_counter ++;
client->process_again = 1;
break;

View File

@ -115,6 +115,7 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
ESP_LOGD(TAG, "HTTP_EVENT_REDIRECT");
esp_http_client_set_header(evt->client, "From", "user@example.com");
esp_http_client_set_header(evt->client, "Accept", "text/html");
esp_http_client_set_redirection(evt->client);
break;
}
return ESP_OK;