Skip to content

Conversation

@Clickau
Copy link
Contributor

@Clickau Clickau commented Aug 10, 2020

Ported from ESP8266 . Fixes issue #3374
The user can use HTTPClient::setFollowRedirects with HTTPC_DISABLE_FOLLOW_REDIRECTS, HTTPC_STRICT_FOLLOW_REDIRECTS or HTTPC_FORCE_FOLLOW_REDIRECTS to enable and disable this feature. Responds to codes 301, 302, 303, 307.

@me-no-dev me-no-dev merged commit ee88c42 into espressif:master Oct 1, 2020
trandi added a commit to trandi/arduino-esp32 that referenced this pull request Oct 3, 2020
trandi added a commit to trandi/arduino-esp32 that referenced this pull request Oct 3, 2020
trandi added a commit to trandi/arduino-esp32 that referenced this pull request Oct 3, 2020
@simonjamain
Copy link

simonjamain commented Nov 20, 2020

@Clickau
I don't know if this is the right place for this, but the new (much wanted) feature doesn't quite work for me. I use it for getting an asset link from the github API (https://github.com/simonjamain/openmosfet/releases/download/0.1.0-alpha/openmosfet.esp32.bin for example) which give a 302 redirect to a much larger url (540 characters).

By setting setFollowRedirects(HTTPC_DISABLE_FOLLOW_REDIRECTS) I got the 302 code but with HTTPC_STRICT_FOLLOW_REDIRECTS or HTTPC_FORCE_FOLLOW_REDIRECTS i get a 404.

You can test this issue by compiling and running my (platformio) project on this specific commit : https://github.com/simonjamain/openmosfet/tree/f326aa19b7b86527de9099b5a1cf89c7045eb2a6

The code starting from line 58 of autoUpdater.cpp will be what you're interested in.

The sequence is started by calling OMAutoUpdater::requestUpdate() which you can do from your network by calling a FETCH request on http://openmosfet.local/api/core or clicking the "Mise à jour" button on the interface at http://openmosfet.local from your browser (and check your serial port).

Hope this is of interest for you, and I didn't do something wrong and wasted you time.

Thank for the much appreciated work (which is way out of my league)!

ps : my board is an ESP32 DEVKIT V1

@thegreatdane6
Copy link

I ran into the same issue as @simonjamain and after some investigation I found the issue. In case of a redirection to an url with a new host, the host does not get replaced. So if one tries to download the latest release off of github, at some point the host swaps from github.com to some amazon storages. In the logs i can see, the location header returns the correct url with the host pointing to the aws storage. From the code linked in the PR i cannot see tough why this happens, the issue must be somewhere within the "beginInternal" function. For now i just implemented a the rediction myself and it works just fine. This should only be temporary solution tough.

@lbernstone
Copy link
Contributor

This is not the place to report issues. Please open an issue if you are not planning on fixing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants