You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTPSConnection double wrapping IPv6 address during CONNECT #100985
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.py
import http.client, ssl
conn = 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.py
400 Bad Request
=== tcp dump showing extra squar brackets in "Host:" header ==
CONNECT [fd2e:6f44:5dd8:c956::15]:5050 HTTP/1.0
HTTP/1.1 200 Connection established
GET / HTTP/1.1
Host: [[fd2e:6f44:5dd8:c956::15]]:5050
Accept-Encoding: identity
Content-Length: 0
HTTP/1.1 400 Bad Request
Date: Thu, 12 Jan 2023 11:47:38 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
Your environment
$ cat /etc/redhat-release
Red Hat Enterprise Linux CoreOS release 4.12
Activity
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT
gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986)
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT (py…
[3.12] gh-100985: Consistently wrap IPv6 IP address during CONNECT (G…
[3.11] pythongh-100985: Consistently wrap IPv6 IP address during CONN…
[3.11] gh-100985: Consistently wrap IPv6 IP address during CONNECT (G…
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT (py…
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT (py…
pythongh-100985: Consistently wrap IPv6 IP address during CONNECT (py…