Skip to content

Commit

Permalink
fix: esp_http_client fix behaviour when disable_auto_redirect is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshal5 committed Nov 14, 2022
1 parent 7f4bcc3 commit 9463a66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/esp_http_client/esp_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9463a66

Please sign in to comment.