Fixed the semantic of timeout for socket.create_connection and

all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
This commit is contained in:
Facundo Batista 2008-05-29 16:39:26 +00:00
parent f18a707205
commit 4f1b1ed975
24 changed files with 231 additions and 180 deletions

View file

@ -639,7 +639,8 @@ class HTTPConnection:
debuglevel = 0
strict = 0
def __init__(self, host, port=None, strict=None, timeout=None):
def __init__(self, host, port=None, strict=None,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
self.timeout = timeout
self.sock = None
self._buffer = []
@ -1055,7 +1056,7 @@ else:
default_port = HTTPS_PORT
def __init__(self, host, port=None, key_file=None, cert_file=None,
strict=None, timeout=None):
strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
HTTPConnection.__init__(self, host, port, strict, timeout)
self.key_file = key_file
self.cert_file = cert_file