Skip to content

HTTPClient crash on GET() for url with 1 redirect #4931

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

Closed
cpainchaud opened this issue Mar 11, 2021 · 5 comments
Closed

HTTPClient crash on GET() for url with 1 redirect #4931

cpainchaud opened this issue Mar 11, 2021 · 5 comments

Comments

@cpainchaud
Copy link

Hardware:

Board: ESP32 Dev Module
Arduino IDE Version : 10805
ESP SDK version: v3.3.4-432-g7a85334d8
IDE name: PIO
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10

Description:

Crash happens when downloading URL with http.setFollowRedirects(followRedirects_t::HTTPC_STRICT_FOLLOW_REDIRECTS);
This URL indeeds forward the client once to the read URL where the binary file is.
Note that the crash does not occur if I give it the relocated URL directly.

Sketch: (leave the backquotes for code formatting)

void setup()
{
  Serial.begin(115200);
  delay(10);

  WiFi.config(IPAddress((uint32_t) 0), IPAddress((uint32_t) 0), IPAddress((uint32_t) 0));
  WiFi.begin("my_network", "my_password");
  WiFi.setAutoConnect(true);
  WiFi.setAutoReconnect(true);
  Serial.println("wait a bit for Wifi to be up");
  delay(10000);

  HTTPClient http;

  Serial.println("Requesting web page now!");

  http.setFollowRedirects(followRedirects_t::HTTPC_STRICT_FOLLOW_REDIRECTS);
  http.begin("https://github.com/cpainchaud/RFLink/releases/download/nightly/esp32-firmware.bin");
  int httpCode = http.GET();


}


void loop()
{

}

Debug Messages:

If you have a Guru Meditation Error or Backtrace, ***please decode it***:
  0  0x400e1235:0x3ffe7f00 in WiFiClient::connect(char const*, unsigned short, int) at /packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiClient.cpp:572
  1  0x400f0876:0x3ffe7f30 in HTTPClient::connect() at /packages/framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:925
  2  0x400f08f7:0x3ffe7f60 in HTTPClient::sendRequest(char const*, unsigned char*, unsigned int) at /packages/framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:925
  3  0x400f0a73:0x3ffe7fb0 in HTTPClient::GET() at /packages/framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:925
  4  0x400d7777:0x3ffe7fd0 in RFLink::OTA::downloadFromUrl(char const*) at RFLink/13_OTA.cpp:29

@me-no-dev
Copy link
Member

I know that PIO can use the development version of this repo. Please check in their docs how to do it and try against that. I added a fix exactly for redirects

@cpainchaud
Copy link
Author

platform = https://github.com/platformio/platform-espressif32.git should do it, i will give it a try !

@cpainchaud
Copy link
Author

cpainchaud commented Mar 11, 2021

Nope :/

Arduino IDE Version : 10805
ESP SDK version: v3.3.4-436-g0bfff0b25

Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x00000000 PS : 0x00060230 A0 : 0x800f18dc A1 : 0x3ffe7e60
A2 : 0x3ffe7f7c A3 : 0x00000000 A4 : 0x02586b9c A5 : 0x3ffc6cfc
A6 : 0x00000000 A7 : 0x3ffe7fb0 A8 : 0x801959e1 A9 : 0x3ffe7e40
A10 : 0x3ffddc40 A11 : 0x3ffe7e80 A12 : 0x3ffde88c A13 : 0x0000000a
A14 : 0x00000000 A15 : 0xff000000 SAR : 0x00000008 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
0 0x00000000:0x3ffe7e60 in ?? ??:0
1 0x400f18d9:0x3ffe7e80 in HTTPClient::connect() at /packages/framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:925
2 0x400f1a4b:0x3ffe7eb0 in HTTPClient::sendRequest(char const*, unsigned char*, unsigned int) at /framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:925
3 0x400f1bc7:0x3ffe7f00 in HTTPClient::GET() at /framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:925

@cpainchaud
Copy link
Author

There was something weird so I decided to wipe .pio and PIO's framework directory to ensure it was not mixing frameworks parts... and i am afraid it's really not fixed

@me-no-dev
Copy link
Member

Took me a while but I figured it out :) fixed in the commit above

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

No branches or pull requests

2 participants