-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
SSL timeouts should raise socket.timeout, not a generic SSLError #54481
Comments
The issue here is that ssl is using its own exception class rather than the socket module's "timeout" class: test test_httplib failed -- Traceback (most recent call last):
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/test/test_httplib.py", line 408, in test_networked
h.request('GET', '/')
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 943, in request
self._send_request(method, url, body, headers)
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 981, in _send_request
self.endheaders(body)
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 939, in endheaders
self._send_output(message_body)
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 791, in _send_output
self.send(msg)
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 737, in send
self.connect()
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 1086, in connect
server_hostname=server_hostname)
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 168, in wrap_socket
_context=self)
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 254, in __init__
raise x
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 250, in __init__
self.do_handshake()
File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 429, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: _ssl.c:374: The handshake operation timed out |
Requalifying this issue so that the ssl module is fixed to raise socket.timeout on socket timeouts, which is not only more logical but much more useful (since you can then specifically handle this error). |
Committed in r86997. I won't backport it to bugfix branches since it is a small compatibility breach. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: