diff options
author | Michael <35783820+mib1185@users.noreply.github.com> | 2023-11-19 23:37:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 22:37:13 +0000 |
commit | ce1096f974d3158a92e050f9226700775b8db398 (patch) | |
tree | 3c0ef4e51e7b67383d513df34f47b0a492ca7dd2 /Lib/test/test_httplib.py | |
parent | 7c9f2677fbb8805f7d531fb96731339727e8ea20 (diff) | |
download | cpython-ce1096f974d3158a92e050f9226700775b8db398.tar.gz cpython-ce1096f974d3158a92e050f9226700775b8db398.zip |
gh-73561: Omit interface scope from IPv6 when used as Host header (#93324)
Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`.
---------
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google LLC]
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r-- | Lib/test/test_httplib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 5d5832b62b2..caa4c76a913 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -283,6 +283,22 @@ class HeaderTests(TestCase): conn.request('GET', '/foo') self.assertTrue(sock.data.startswith(expected)) + expected = b'GET /foo HTTP/1.1\r\nHost: [fe80::]\r\n' \ + b'Accept-Encoding: identity\r\n\r\n' + conn = client.HTTPConnection('[fe80::%2]') + sock = FakeSocket('') + conn.sock = sock + conn.request('GET', '/foo') + self.assertTrue(sock.data.startswith(expected)) + + expected = b'GET /foo HTTP/1.1\r\nHost: [fe80::]:81\r\n' \ + b'Accept-Encoding: identity\r\n\r\n' + conn = client.HTTPConnection('[fe80::%2]:81') + sock = FakeSocket('') + conn.sock = sock + conn.request('GET', '/foo') + self.assertTrue(sock.data.startswith(expected)) + def test_malformed_headers_coped_with(self): # Issue 19996 body = "HTTP/1.1 200 OK\r\nFirst: val\r\n: nval\r\nSecond: val\r\n\r\n" |