mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 09:39:10 -04:00
Merge branch 'contrib/github_pr_8564' into 'master'
Fix nested redirect (GitHub PR) Closes IDFGH-6943 and IDFGH-6944 See merge request espressif/esp-idf!17478
This commit is contained in:
commit
16ebc608db
@ -512,6 +512,16 @@ static esp_err_t esp_http_client_prepare(esp_http_client_handle_t client)
|
||||
client->process_again = 0;
|
||||
client->response->data_process = 0;
|
||||
client->first_line_prepared = false;
|
||||
/**
|
||||
* Clear location field before making a new HTTP request. Location
|
||||
* field should not be cleared in http_on_header* callbacks because
|
||||
* callbacks can be invoked multiple times for same header, and
|
||||
* hence can lead to data corruption.
|
||||
*/
|
||||
if (client->location != NULL) {
|
||||
free(client->location);
|
||||
client->location = NULL;
|
||||
}
|
||||
http_parser_init(client->parser, HTTP_RESPONSE);
|
||||
if (client->connection_info.username) {
|
||||
char *auth_response = NULL;
|
||||
|
@ -416,8 +416,9 @@ def test_examples_protocol_advanced_https_ota_example_redirect_url(env, extra_da
|
||||
"""
|
||||
dut1 = env.get_dut('advanced_https_ota_example', 'examples/system/ota/advanced_https_ota', dut_class=ttfw_idf.ESP32DUT)
|
||||
server_port = 8001
|
||||
# Port to which the request should be redirecetd
|
||||
# Port to which the request should be redirected
|
||||
redirection_server_port = 8081
|
||||
redirection_server_port1 = 8082
|
||||
# File to be downloaded. This file is generated after compilation
|
||||
bin_name = 'advanced_https_ota.bin'
|
||||
# check and log bin size
|
||||
@ -430,9 +431,12 @@ def test_examples_protocol_advanced_https_ota_example_redirect_url(env, extra_da
|
||||
thread1 = multiprocessing.Process(target=start_https_server, args=(dut1.app.binary_path, host_ip, server_port))
|
||||
thread1.daemon = True
|
||||
thread1.start()
|
||||
thread2 = multiprocessing.Process(target=start_redirect_server, args=(dut1.app.binary_path, host_ip, redirection_server_port, server_port))
|
||||
thread2 = multiprocessing.Process(target=start_redirect_server, args=(dut1.app.binary_path, host_ip, redirection_server_port, redirection_server_port1))
|
||||
thread2.daemon = True
|
||||
thread2.start()
|
||||
thread3 = multiprocessing.Process(target=start_redirect_server, args=(dut1.app.binary_path, host_ip, redirection_server_port1, server_port))
|
||||
thread3.daemon = True
|
||||
thread3.start()
|
||||
dut1.start_app()
|
||||
dut1.expect('Loaded app from partition at offset', timeout=30)
|
||||
try:
|
||||
@ -441,6 +445,7 @@ def test_examples_protocol_advanced_https_ota_example_redirect_url(env, extra_da
|
||||
except DUT.ExpectTimeout:
|
||||
thread1.terminate()
|
||||
thread2.terminate()
|
||||
thread3.terminate()
|
||||
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')
|
||||
dut1.expect('Starting Advanced OTA example', timeout=30)
|
||||
|
||||
@ -451,6 +456,7 @@ def test_examples_protocol_advanced_https_ota_example_redirect_url(env, extra_da
|
||||
dut1.reset()
|
||||
thread1.terminate()
|
||||
thread2.terminate()
|
||||
thread3.terminate()
|
||||
|
||||
|
||||
@ttfw_idf.idf_example_test(env_tag='Example_8Mflash_Ethernet')
|
||||
|
Loading…
x
Reference in New Issue
Block a user