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
httplib: wrong Host header when connecting to IPv6 link-local address #73561
An IPv6 link-local address must include a scope specifier as part of the address passed to the HTTPConnection or HTTPSConnection constructor, that scope specifier is not being stripped from the address passed in the HTTP 1.1 Host: header line.
So, suppose I was attempting to connect to an HTTP server on fe80::8aae:1dff:fea4:29c8. That's a link-local address, so I must give the scope specifier, which is the interface I can use to connect to that address. So, the address I would pass to the HTTPConnection constructor might look like "fe80::8aae:1dff:fea4:29c8%eth0". The appropriate Host line in the HTTP request would be "Host: [fe80::8aae:1dff:fea4:29c8]" but it is actually "Host: [fe80::8aae:1dff:fea4:29c8%eth0]"
Compliant HTTP servers reject requests including this line as malformed.
More closely related: bpo-23448, about the same thing with urllib, which adds the Host value itself. Any solution should be shared between both modules.
JonathanGuthrie commented on Jan 26, 2017
JonathanGuthriemannequin
MannequinAuthor
More actions
Yes, it is more closely related to bpo-23448. My search for related issues apparently wasn't exhaustive enough.
Hi,
according to the dev-guid - reviewing, i would like to "ping" this issue.
Do you mind to have a look into the linked PR? Unfortunately it is without a review since more than a year, but it is a quite small PR to fix this issue.
thx
Activity
JonathanGuthrie commentedon Jan 25, 2017
This is related to bpo-5111.
An IPv6 link-local address must include a scope specifier as part of the address passed to the HTTPConnection or HTTPSConnection constructor, that scope specifier is not being stripped from the address passed in the HTTP 1.1 Host: header line.
So, suppose I was attempting to connect to an HTTP server on fe80::8aae:1dff:fea4:29c8. That's a link-local address, so I must give the scope specifier, which is the interface I can use to connect to that address. So, the address I would pass to the HTTPConnection constructor might look like "fe80::8aae:1dff:fea4:29c8%eth0". The appropriate Host line in the HTTP request would be "Host: [fe80::8aae:1dff:fea4:29c8]" but it is actually "Host: [fe80::8aae:1dff:fea4:29c8%eth0]"
Compliant HTTP servers reject requests including this line as malformed.
vadmium commentedon Jan 25, 2017
More closely related: bpo-23448, about the same thing with urllib, which adds the Host value itself. Any solution should be shared between both modules.
JonathanGuthrie commentedon Jan 26, 2017
Yes, it is more closely related to bpo-23448. My search for related issues apparently wasn't exhaustive enough.
mib1185 commentedon Jul 5, 2023
Hi,
according to the dev-guid - reviewing, i would like to "ping" this issue.
Do you mind to have a look into the linked PR? Unfortunately it is without a review since more than a year, but it is a quite small PR to fix this issue.
thx
mib1185 commentedon Aug 17, 2023
Hi,
according to the dev-guid - reviewing, i would like to "ping" this issue.
Do you mind to have a look into the linked PR?
thx
gh-73561: Omit interface scope from IPv6 when used as Host header (#9…
pythongh-73561: Omit interface scope from IPv6 when used as Host head…
pythongh-73561: Omit interface scope from IPv6 when used as Host head…
[3.12] gh-73561: Omit interface scope from IPv6 when used as Host hea…
[3.11] gh-73561: Omit interface scope from IPv6 when used as Host hea…
pythongh-73561: Omit interface scope from IPv6 when used as Host head…
pythongh-73561: Omit interface scope from IPv6 when used as Host head…