10000 gh-100985: Consistently wrap IPv6 IP address during CONNECT by derekhiggins · Pull Request #100986 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100985: Consistently wrap IPv6 IP address during CONNECT #100986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
  • Loading branch information
serhiy-storchaka authored Feb 17, 2024
commit a79047ecd920fb65ed620e77756bb781d0ca8c5b
2 changes: 1 addition & 1 deletion Lib/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def set_debuglevel(self, level):
self.debuglevel = level

def _wrap_ipv6(self, ip):
if ip.find(b':') >= 0 and ip.find(b'[') != 0:
if b':' in ip and ip[0] != b'['[0]:
return b"[" + ip + b"]"
return ip

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,6 @@ def test_connect_put_request_ipv6_port(self):
self.assertIn(b'CONNECT [1:2:3::4]:1234', self.conn.sock.data)
self.assertIn(b'Host: [1:2:3::4]:1234', self.conn.sock.data)


def test_tunnel_debuglog(self):
expected_header = 'X-Dummy: 1'
response_text = 'HTTP/1.0 200 OK\r\n{}\r\n\r\n'.format(expected_header)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Update HTTPSConnection to consistently wrap IPv6 Addresses when using a
proxy
proxy.
0