-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp_http_client redirect to new host not supported (IDFGH-434) #2631
Comments
Alvin1Zhang
changed the title
esp_http_client redirect to new host not supported
[TW#27006] esp_http_client redirect to new host not supported
Oct 26, 2018
@anders-above Thanks for bringing this to our notice. We'll address it soon. |
I tried reproducing the issue by running a local server which redirects to another host, and it seems to work. So, I am sharing the log and python script with you. Let me know if I am missing something.
Redirect python server script( copied from https://gist.github.com/shreddd/b7991ab491384e3c3331)
|
projectgus
changed the title
[TW#27006] esp_http_client redirect to new host not supported
esp_http_client redirect to new host not supported (IDFGH-434)
Mar 12, 2019
igrr
pushed a commit
to espressif/esp-adf
that referenced
this issue
Mar 29, 2019
Operation: In esp_http_client_set_url, we check for if old_host is same as new_host. Delete and open new connection if host is different. Issue: We just pointed client->connection_info.host to old_host and reassigned it. This made old_host and new_host always point to same location and hence, using old_host with new request. Fix: Made a separate copy for old_host using strdup. Related issue on github: espressif/esp-idf#2631 Related merge request on idf: https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/4623/ Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
igrr
pushed a commit
that referenced
this issue
Apr 28, 2019
Operation: In `esp_http_client_set_url`, we check for if old_host is same as new_host. Delete and open new connection if host is different. Issue: We just pointed `client->connection_info.host` to `old_host` and reassigned it. This made old_host and new_host always point to same location and hence, using old_host with new request. Fix: Made a separate copy for old_host using strdup. Closes #2631 Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
igrr
pushed a commit
that referenced
this issue
May 10, 2019
Operation: In `esp_http_client_set_url`, we check for if old_host is same as new_host. Delete and open new connection if host is different. Issue: We just pointed `client->connection_info.host` to `old_host` and reassigned it. This made old_host and new_host always point to same location and hence, using old_host with new request. Fix: Made a separate copy for old_host using strdup. Closes #2631 Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
catalinio
pushed a commit
to catalinio/pycom-esp-idf
that referenced
this issue
Jun 28, 2019
Operation: In `esp_http_client_set_url`, we check for if old_host is same as new_host. Delete and open new connection if host is different. Issue: We just pointed `client->connection_info.host` to `old_host` and reassigned it. This made old_host and new_host always point to same location and hence, using old_host with new request. Fix: Made a separate copy for old_host using strdup. Closes espressif/esp-idf#2631 Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
git rev-parse --short HEAD
to get the commit id.): 22da5f6Problem Description
esp_http_client_perform() fails if the server returns a HTTP/301 Redirect with Location set to a different hostname
It will retry with the new URL, but without disconnecting from the current server.
This code in esp_http_client_set_url() doesn't work, since http_utils_assign_string overwrites the data that should have been stored in old_host:
Expected Behavior
It should reconnect to the new host
Actual Behavior
Continues to connect to the same host, which will trigger HTTP_CLIENT: Error, reach max_redirection_count count=10
Steps to repropduce
Debug Logs
The text was updated successfully, but these errors were encountered: