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
[SendToHttp] Do not set HTTP authentication when no user/pass set #4205
Conversation
A number of setups may report HTP error 401 since the 20220809 build. This fix should not add an auth header if no user/pass is set.
@tonhuisman Sure but what is a action build? |
Testet with ESP_Easy_mega_20220816_normal_ESP8266_4M1M, same problem, not fixed. |
Can you give an example of what you're trying to send and perhaps to what kind of webserver? |
242670 : Info : EVENT: MS#State=1 I hope I used the action build correctly, the esphost1host is not running and the connection failure for this is correct. |
FYI I have just quickly tested the Generic HTTP & Generic HTTP Advanced controllers on latest Custom ESP firmware (compiled yesterday without PR4205) with Port Listener app. as a target. 5503126: HTTP : C008 192.168.44.34 GET... failed HTTP code: -11 read Timeout And the target accepted the connection repeatedly (as it is just listener, without any reply to initiator): Client connected Client disconnected |
Still to do: look into why not all HTTP requests seem to arrive at the other node when sending at short intervals (less than 3 sec)
I also fixed some issue where (especially on ESP32) a second call to some HTTP server may fail until some (long) timeout or another call to a different host was made. @ghtester can you test this PR? |
Thanks for your work, as already reported in #4208 thread, unfortunately I still see the Timeout issues. |
WiFiClient has a setTimeout function which expects seconds. The parent class, Client, does expect msec. So by casting to its parent and then calling setTimeout, we can again set the timeout in msec.
Otherwise it is set to 4000 msec. For servers that won't send an ack, you would otherwise always hit this 4000 msec timeout, which is way too long.
The set timeout is now considered a minimum timeout. If it isn't enough, it will dynamically rise until it is enough. Typical used timeout is 3x the last encountered duration, with a minimum set in the controller settings.
This setting is set for a reason, like the server may never reply/ack. If set, the duration will always match the set timeout and thus increase over time.
For the controllers, I made the timeout dynamic (unless it is set to ignore ack). Still thinking whether I should make this dynamic behavior optional. |
A number of setups may report HTP error 401 since the 20220809 build.
This fix should not add an auth header if no user/pass is set.
Fixes: #4203
Fixes: #4208