[Python-checkins] r85367 - in python/branches/issue9003/Lib: http/client.py test/ssl_servers.py
antoine.pitrou
python-checkins at python.org
Mon Oct 11 21:19:14 CEST 2010
Author: antoine.pitrou
Date: Mon Oct 11 21:19:14 2010
New Revision: 85367
Log:
Try to fix buildbot hangs
Modified:
python/branches/issue9003/Lib/http/client.py
python/branches/issue9003/Lib/test/ssl_servers.py
Modified: python/branches/issue9003/Lib/http/client.py
==============================================================================
--- python/branches/issue9003/Lib/http/client.py (original)
+++ python/branches/issue9003/Lib/http/client.py Mon Oct 11 21:19:14 2010
@@ -1082,8 +1082,12 @@
self._tunnel()
self.sock = self._context.wrap_socket(sock)
- if self._check_hostname:
- ssl.match_hostname(self.sock.getpeercert(), self.host)
+ try:
+ if self._check_hostname:
+ ssl.match_hostname(self.sock.getpeercert(), self.host)
+ except Exception:
+ self.sock.shutdown(socket.SHUT_RDWR)
+ raise
__all__.append("HTTPSConnection")
Modified: python/branches/issue9003/Lib/test/ssl_servers.py
==============================================================================
--- python/branches/issue9003/Lib/test/ssl_servers.py (original)
+++ python/branches/issue9003/Lib/test/ssl_servers.py Mon Oct 11 21:19:14 2010
@@ -21,7 +21,6 @@
_HTTPServer.__init__(self, server_address, handler_class)
# we assume the certfile contains both private key and certificate
self.certfile = certfile
- self.allow_reuse_address = True
def __str__(self):
return ('<%s %s:%s>' %
@@ -43,6 +42,8 @@
server_version = "TestHTTPS/1.0"
root = here
+ # Avoid hanging when a request gets interrupted by the client
+ timeout = 5
def translate_path(self, path):
"""Translate a /-separated PATH to the local filename syntax.
More information about the Python-checkins
mailing list