diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-18 16:52:20 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-18 16:52:20 (GMT) |
commit | 7a616f2fc5391f5899825a5e8fdc0d96ea6c7725 (patch) | |
tree | 0f0d55d5f6273efbb0562d08c363b76e0325a3ab /Lib/test | |
parent | cc9ca223d62fdcf09f22d3cc8eb924cadba6d693 (diff) | |
parent | b4410dbea699eb59358d3d61f45749173167d69a (diff) | |
download | cpython-7a616f2fc5391f5899825a5e8fdc0d96ea6c7725.zip cpython-7a616f2fc5391f5899825a5e8fdc0d96ea6c7725.tar.gz cpython-7a616f2fc5391f5899825a5e8fdc0d96ea6c7725.tar.bz2 |
Issue #12065: connect_ex() on an SSL socket now returns the original errno
when the socket's timeout expires (it used to return None).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ssl.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 2af2e5c..aef51e3 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -519,6 +519,23 @@ class NetworkedTests(unittest.TestCase): finally: s.close() + def test_timeout_connect_ex(self): + # Issue #12065: on a timeout, connect_ex() should return the original + # errno (mimicking the behaviour of non-SSL sockets). + with support.transient_internet("svn.python.org"): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_REQUIRED, + ca_certs=SVN_PYTHON_ORG_ROOT_CERT, + do_handshake_on_connect=False) + try: + s.settimeout(0.0000001) + rc = s.connect_ex(('svn.python.org', 443)) + if rc == 0: + self.skipTest("svn.python.org responded too quickly") + self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK)) + finally: + s.close() + def test_connect_with_context(self): with support.transient_internet("svn.python.org"): # Same as test_connect, but with a separately created context |