Skip to content

Commit 5cb2821

Browse files
Martijn van Oosterhoutjeyrce
Martijn van Oosterhout
authored andcommitted
SSLIOStream: Handle CertificateErrors like other errors
Fixes: tornadoweb#2689
1 parent c92b883 commit 5cb2821

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tornado/iostream.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,10 @@ def _do_ssl_handshake(self) -> None:
13871387
)
13881388
return self.close(exc_info=err)
13891389
raise
1390+
except ssl.CertificateError as err:
1391+
# CertificateError can happen during handshake (hostname
1392+
# verification) and should be passed to user
1393+
return self.close(exc_info=err)
13901394
except socket.error as err:
13911395
# Some port scans (e.g. nmap in -sT mode) have been known
13921396
# to cause do_handshake to raise EBADF and ENOTCONN, so make

0 commit comments

Comments
 (0)