Issue #5103: SSL handshake would ignore the socket timeout and block

indefinitely if the other end didn't respond.
This commit is contained in:
Antoine Pitrou 2010-04-24 20:04:58 +00:00
parent 4d3e372ff3
commit fc69af1562
4 changed files with 102 additions and 10 deletions

View file

@ -115,12 +115,7 @@ class SSLSocket(socket):
cert_reqs, ssl_version, ca_certs,
ciphers)
if do_handshake_on_connect:
timeout = self.gettimeout()
try:
self.settimeout(None)
self.do_handshake()
finally:
self.settimeout(timeout)
self.do_handshake()
self.keyfile = keyfile
self.certfile = certfile
self.cert_reqs = cert_reqs