diff options
Diffstat (limited to 'Lib/http/client.py')
-rw-r--r-- | Lib/http/client.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 5581903..d35f245 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -634,8 +634,9 @@ class HTTPConnection: strict = 0 def __init__(self, host, port=None, strict=None, - timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): self.timeout = timeout + self.source_address = source_address self.sock = None self._buffer = [] self.__response = None @@ -707,7 +708,7 @@ class HTTPConnection: def connect(self): """Connect to the host and port specified in __init__.""" self.sock = socket.create_connection((self.host,self.port), - self.timeout) + self.timeout, self.source_address) if self._tunnel_host: self._tunnel() @@ -1042,8 +1043,10 @@ else: default_port = HTTPS_PORT def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): - HTTPConnection.__init__(self, host, port, strict, timeout) + strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + source_address=None): + super(HTTPSConnection, self).__init__(host, port, strict, timeout, + source_address) self.key_file = key_file self.cert_file = cert_file @@ -1051,7 +1054,7 @@ else: "Connect to a host on a given (SSL) port." sock = socket.create_connection((self.host, self.port), - self.timeout) + self.timeout, self.source_address) if self._tunnel_host: self.sock = sock |