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, :)
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 5696467..1bca5da 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -639,7 +639,8 @@
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 @@
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