Skip to content

Commit d14cb06

Browse files
committed
In SSLIOStream, delay the connect_callback until the SSL handshake finishes.
1 parent f2f504c commit d14cb06

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tornado/iostream.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ def _do_ssl_handshake(self):
408408
return self.close()
409409
else:
410410
self._ssl_accepting = False
411+
super(SSLIOStream, self)._handle_connect()
411412

412413
def _handle_read(self):
413414
if self._ssl_accepting:
@@ -425,7 +426,10 @@ def _handle_connect(self):
425426
# TODO(bdarnell): cert verification, etc
426427
self.socket = ssl.wrap_socket(self.socket,
427428
do_handshake_on_connect=False)
428-
super(SSLIOStream, self)._handle_connect()
429+
# Don't call the superclass's _handle_connect (which is responsible
430+
# for telling the application that the connection is complete)
431+
# until we've completed the SSL handshake (so certificates are
432+
# available, etc).
429433

430434

431435
def _read_from_socket(self):

0 commit comments

Comments
 (0)