New submission from Jacques Grove <jacq...@tripitinc.com>: In ssl.py of Python 2.6.1 we have this code in SSLSocket.__init__():
if do_handshake_on_connect: timeout = self.gettimeout() try: self.settimeout(None) self.do_handshake() finally: self.settimeout(timeout) The problem is, what happens if the remote end (server) is hanging when do_handshake() is called? The result is that the user-requested timeout will be ignored, and the connection will hang until the TCP socket timeout expires. This is easily reproducable with this test code: import urllib2 urllib2.urlopen("https://localhost:9000/", timeout=2.0) and running netcat on port 9000, i.e.: nc -l -p 9000 localhost If you use "http" instead of "https", the timeout works as expected (after 2 seconds in this case). ---------- components: Library (Lib) messages: 80790 nosy: jacques severity: normal status: open title: ssl.SSLSocket timeout not working correctly when remote end is hanging type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5103> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com