GET/POST requests will get stuck if connection loss
biank88 opened this issue · 2 comments
biank88 commented
ESP8266/HTTPSRedirect/HTTPSRedirect.cpp
Line 320 in 0e3edc3
// Skip any empty lines
do{
line = readStringUntil('\n');
}while(line.length() == 0);
Problem
The number of empty lines has no bound, in particular, an empty line
might be created as a result of a timeout during a connection loss.
enindza commented
Yes, it seems like that loop is a problem.
Connection lost will stuck program in that loop if the router is disconnect only during execution of client->POST (didn't test with GET).
Adding timeout seems to help.
uint32_t timeout_ms = 950;
uint32_t t = millis();
do{
line = readStringUntil('\n');
}while(millis() - t < timeout_ms and line.length() == 0);
950ms timeout will not do much since it will still have to wait for readStringUntil default timeout.
electronicsguy commented
Thanks for this. I'll test it more on my side and update as needed.