summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2007-05-21 17:32:32 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2007-05-21 17:32:32 (GMT)
commit70f996be24dd00c11500cd99d92e8b2a1dfaa501 (patch)
treeb60861e73678368f2690057584e42faf1eaa41ef /Lib/httplib.py
parent767debb6aa5729e919da309ecc770f8b2d94beba (diff)
downloadcpython-70f996be24dd00c11500cd99d92e8b2a1dfaa501.zip
cpython-70f996be24dd00c11500cd99d92e8b2a1dfaa501.tar.gz
cpython-70f996be24dd00c11500cd99d92e8b2a1dfaa501.tar.bz2
Added timeout support to HTTPSConnection, through the
socket.create_connection function. Also added a small test for this, and updated NEWS file.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index d420f46..badaf1a 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -1124,16 +1124,15 @@ class HTTPSConnection(HTTPConnection):
default_port = HTTPS_PORT
def __init__(self, host, port=None, key_file=None, cert_file=None,
- strict=None):
- HTTPConnection.__init__(self, host, port, strict)
+ strict=None, timeout=None):
+ HTTPConnection.__init__(self, host, port, strict, timeout)
self.key_file = key_file
self.cert_file = cert_file
def connect(self):
"Connect to a host on a given (SSL) port."
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect((self.host, self.port))
+ sock = socket.create_connection((self.host, self.port), self.timeout)
ssl = socket.ssl(sock, self.key_file, self.cert_file)
self.sock = FakeSocket(sock, ssl)