summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-12-12 07:29:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-12-12 07:29:15 (GMT)
commit4ac7ed97a8cabb5dba6aa25e32cd59d9854dda90 (patch)
tree80294759ce4fdeca3751c1b69348b79255b0623e /Lib/http
parent1e40f10886f1c83e47f69ab229b27ab2eceff939 (diff)
downloadcpython-4ac7ed97a8cabb5dba6aa25e32cd59d9854dda90.zip
cpython-4ac7ed97a8cabb5dba6aa25e32cd59d9854dda90.tar.gz
cpython-4ac7ed97a8cabb5dba6aa25e32cd59d9854dda90.tar.bz2
Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The port
value in the host header was set to "None". Patch by Demian Brecht.
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/client.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index c0760dd..6de4b0e 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -771,8 +771,7 @@ class HTTPConnection:
if self.sock:
raise RuntimeError("Can't set up tunnel for established connection")
- self._tunnel_host = host
- self._tunnel_port = port
+ self._tunnel_host, self._tunnel_port = self._get_hostport(host, port)
if headers:
self._tunnel_headers = headers
else:
@@ -802,9 +801,8 @@ class HTTPConnection:
self.debuglevel = level
def _tunnel(self):
- (host, port) = self._get_hostport(self._tunnel_host,
- self._tunnel_port)
- connect_str = "CONNECT %s:%d HTTP/1.0\r\n" % (host, port)
+ connect_str = "CONNECT %s:%d HTTP/1.0\r\n" % (self._tunnel_host,
+ self._tunnel_port)
connect_bytes = connect_str.encode("ascii")
self.send(connect_bytes)
for header, value in self._tunnel_headers.items():