Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
when http.client.HTTPSConnection is used with IPv6 addresses and a proxy results in the "Host:" Header being
wrapped in square brackets twice. (e.g. Host: [[fd2e:6f44:5dd8:c956::15]]:5050 )
$ cat /tmp/proxy_test.pyimport http.client, sslconn = http.client.HTTPSConnection("fd2e:6f44:5dd8:c956::1", 8215, context=ssl._create_unverified_context())conn.set_tunnel("[fd2e:6f44:5dd8:c956::15]", 5050)conn.request("GET", "/", "")response = conn.getresponse()print(response.status, response.reason)$ python3 /tmp/proxy_test.py400 Bad Request=== tcp dump showing extra squar brackets in "Host:" header ==CONNECT [fd2e:6f44:5dd8:c956::15]:5050 HTTP/1.0HTTP/1.1 200 Connection establishedGET / HTTP/1.1Host: [[fd2e:6f44:5dd8:c956::15]]:5050Accept-Encoding: identityContent-Length: 0HTTP/1.1 400 Bad RequestDate: Thu, 12 Jan 2023 11:47:38 GMTServer: ApacheContent-Length: 226Connection: closeContent-Type: text/html; charset=iso-8859-1Your environment
$ cat /etc/redhat-release
Red Hat Enterprise Linux CoreOS release 4.12
$ rpm -qf /usr/bin/python3
python3-3.9.10-4.el9_0.x86_64