Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix HTTP Client with SSL #3216
@me-no-dev Why so difficult? Why where the ::connect() methods with timeout introduced in the first place? Wouldn't it be far better to call the parent class WiFiClient::setTimeout() method?
I did not have time to check it, but I think there is a nasty error in start_ssl_client() that might be the root cause of the problems. In this line and the next, not a pointer and a sizeof() an int should be passed, but a pointer and a sizeof a struct timeval. I think because the first element of the struct is a timeout in seconds, the error was never discovered...
In the above code a timeout in milliseconds is set, but, since WiFiClient::setTimeout() is in seconds, I strongly believe (just because this method existed earlier than ::setHandshakeTimeout(), which is in milliseconds) that the connect() timeout parameter should be in seconds. But, even better: remove these methods and call the parent class setTimeout()
Also, because the timeouts are messy between WiFiClient, HTTPClient and the socket timeout that the timeout parameters should be renamed to show in what unit they are, so not int32_t timeout but int32_t timeout_milliseconds or something like that.
Also I think that this line could also better be replaced by the parent class WiFiClient::setNoDelay()
I did not test any of this, I did not even try to code it, so maybe I am completely wrong...