diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-28 19:37:13 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-28 19:37:13 (GMT) |
commit | 9d1de8a2a983e6baa39dbc8587b1730e8ce89956 (patch) | |
tree | a84c3406c0427c26a8ce73ebca059869b49e8bc2 /Lib/httplib.py | |
parent | 2c992a0788536087bfd78da8f2c62b30a461d7e2 (diff) | |
download | cpython-9d1de8a2a983e6baa39dbc8587b1730e8ce89956.zip cpython-9d1de8a2a983e6baa39dbc8587b1730e8ce89956.tar.gz cpython-9d1de8a2a983e6baa39dbc8587b1730e8ce89956.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/httplib.py')
-rw-r--r-- | Lib/httplib.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 30fc525..fc908d2 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -772,8 +772,7 @@ class HTTPConnection: if self.sock: raise RuntimeError("Can't setup 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,8 +801,8 @@ class HTTPConnection: self.debuglevel = level def _tunnel(self): - (host, port) = self._get_hostport(self._tunnel_host, self._tunnel_port) - self.send("CONNECT %s:%d HTTP/1.0\r\n" % (host, port)) + self.send("CONNECT %s:%d HTTP/1.0\r\n" % (self._tunnel_host, + self._tunnel_port)) for header, value in self._tunnel_headers.iteritems(): self.send("%s: %s\r\n" % (header, value)) self.send("\r\n") |