From 4995f4ef9985f6bfc76ea34a72af3b21876c2a44 Mon Sep 17 00:00:00 2001 From: kenneth topp Date: Wed, 21 Sep 2022 22:38:51 -0400 Subject: [PATCH] Handle SSLZeroReturnError exceptions. --- cheroot/ssl/builtin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cheroot/ssl/builtin.py b/cheroot/ssl/builtin.py index ff987a7102..2409fcdf61 100644 --- a/cheroot/ssl/builtin.py +++ b/cheroot/ssl/builtin.py @@ -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 as ex: + # 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