Skip to content

Commit

Permalink
Handle SSLZeroReturnError exceptions
Browse files Browse the repository at this point in the history
Python 3.8 introduced a different exception for zero byte tcp
connections.  These connections are generated by cherrypy on
startup, and so the exception is not displayed as it is expected.
Without this fix an exception is displayed although it is harmless.
This treats the new exception just like it was treated under the
errno exception.
  • Loading branch information
toppk authored and webknjaz committed Sep 29, 2022
1 parent ec51fbb commit 6d4af62
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cheroot/ssl/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ def wrap(self, sock):
s = self.context.wrap_socket(
sock, do_handshake_on_connect=True, server_side=True,
)
except ssl.SSLZeroReturnError:
# This is almost certainly due to the cherrypy engine
# 'pinging' the socket to assert it's connectable;
# the 'ping' isn't SSL.
return EMPTY_RESULT
except ssl.SSLError as ex:
if ex.errno == ssl.SSL_ERROR_EOF:
# This is almost certainly due to the cherrypy engine
Expand Down

0 comments on commit 6d4af62

Please sign in to comment.