I have a 64bit windows application that hosts a REST server using restbed, it was built with Visual Studio 2015.
When I test the REST API using the python scripts with the debug build all works fine without any errors, however when I test the same program using the release build I randomly get socket connection exceptions thrown in the python code. e.g.
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\site-packages\urllib3\contrib\pyopenssl.py", line 313, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "C:\Program Files\Python38\lib\site-packages\OpenSSL\SSL.py", line 1840, in recv_into
self._raise_ssl_error(self._ssl, result)
File "C:\Program Files\Python38\lib\site-packages\OpenSSL\SSL.py", line 1663, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (10054, 'WSAECONNRESET')
I am using requests V2.23.0 & pyOpenSSL V19.1.0. My certificate is self-signed.
Any suggestions? Is there a way of forcing restbed to use tlsv1.2 so that I can use wireshark to see what is going on?
The problem ended being nothing to do with HTTPS or even HTTP. But due to having data left on the socket when the session was closed. This resulted in the socket being closed with the Reset flag set instead of the FIN flag. Was a bug in the processing of the requests on the server side! Opps.