Skip to content

Commit 158239e

Browse files
ajyoungwebknjaz
authored andcommitted
Uncaught socket exception during timeout handling
1 parent 85b8dc9 commit 158239e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cheroot/ssl/pyopenssl.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,14 @@ def _safe_call(self, is_reader, call, *args, **kwargs): # noqa: C901
104104
except SSL.WantWriteError:
105105
time.sleep(self.ssl_retry)
106106
except SSL.SysCallError as e:
107-
if is_reader and e.args == (-1, 'Unexpected EOF'):
108-
return b''
107+
if e.args == (-1, 'Unexpected EOF'):
108+
if is_reader:
109+
return b''
110+
else:
111+
# See #210. Prevents DOS attack caused by
112+
# silent connections lasting beyond connection
113+
# timeout length.
114+
raise errors.FatalSSLAlert(*e.args)
109115

110116
errnum = e.args[0]
111117
if is_reader and errnum in errors.socket_errors_to_ignore:

0 commit comments

Comments
 (0)