mirror of
https://github.com/python/cpython.git
synced 2025-08-09 11:29:45 +00:00
[3.12] gh-73561: Omit interface scope from IPv6 when used as Host header (GH-93324) (#112272)
gh-73561: Omit interface scope from IPv6 when used as Host header (GH-93324)
Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`.
---------
(cherry picked from commit ce1096f974
)
[Google LLC]
Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
This commit is contained in:
parent
cf8c830755
commit
d4fd165aba
3 changed files with 27 additions and 2 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue