There was a problem hiding this comment.
Thanks for providing the PR, I'll try to check it on a board asap.
However, during the code review I noticed this line (which has been there already before the PR):
Using size_t instead of ssize_t means that no underlying SSL error will ever be reported to the caller. That alone will cause trouble when using readBytesToBuffer(). The same goes for passing the return value of recv() in the basic HTTPConnection variant.
In particular, this means that the else branch in HTTPConnection.cpp:195..212 will never be reached with an int readReturnCode being set based on a size_t.
So I would be curious if you ever saw that added SSL_error=... message in your logs?
Sorry, something went wrong.
Possible fix for #85
The trigger of this problem can be network disconnections or similar errors coming via SSL.
In HTTPConnection::updateBuffer() closeConnection() is called when error is detected from SSL to clean up but the possibility of already cleaned up session is not handled in HTTPConnection::pendingBufferSize() and in HTTPConnection::loop().
Also in such case WSHandler::onClose() is not called therefore the recorded handlers (like in the websocket example) are not cleaned up.