diff options
author | Bas Zoetekouw <bas.zoetekouw@surf.nl> | 2022-12-21 09:32:44 +0100 |
---|---|---|
committer | Sergey Shepelev <temotor@gmail.com> | 2023-01-18 04:02:49 +0300 |
commit | caf9f9983a43c537efff5c4c9ff1d543af6e1220 (patch) | |
tree | 1420ab827e80b603b7131d2b3482e65d1f4d5120 | |
parent | b034167818e6fd13a45dca2853afc20d70976ea2 (diff) | |
download | eventlet-caf9f9983a43c537efff5c4c9ff1d543af6e1220.tar.gz |
Change ssl to return a socket.timeout exception on timeout instead of an SSLError
Back in Python 3.2, ssl.SSLError used to be a subclass of socket.error (see
https://docs.python.org/3/library/ssl.html#exceptions), so timeouts on
monkeypatched ssl sockets would be properly caught by socket.timeout
excpetion handlers in applications. However, since Python 3.3 ssl.SSLerror
is a subclass of OSError, which signifies a different (typically fatal)
type of error that is usually not handled gracefully by applications.
By changing the timeout excpetion back to socket.timeout, libraries such
as pymysql and redis will again properly support TLS-connections in
monkeypatched apoplications.
-rw-r--r-- | eventlet/green/ssl.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/eventlet/green/ssl.py b/eventlet/green/ssl.py index b42ddaa..be4f29b 100644 --- a/eventlet/green/ssl.py +++ b/eventlet/green/ssl.py @@ -15,7 +15,7 @@ from contextlib import contextmanager orig_socket = __import__('socket') socket = orig_socket.socket -timeout_exc = SSLError +timeout_exc = orig_socket.timeout __patched__ = [ 'SSLSocket', 'SSLContext', 'wrap_socket', 'sslwrap_simple', |