-
-
Notifications
You must be signed in to change notification settings - Fork 32k
httplib: wrong Host header when connecting to IPv6 link-local address #73561
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
Comments
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. |
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. |
Yes, it is more closely related to bpo-23448. My search for related issues apparently wasn't exhaustive enough. |
Hi, |
Hi, |
…3324) Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`. --------- Co-authored-by: Gregory P. Smith <[email protected]> [Google LLC]
…er (pythonGH-93324) Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`. --------- (cherry picked from commit ce1096f) Co-authored-by: Michael <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]> [Google LLC]
…er (pythonGH-93324) Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`. --------- (cherry picked from commit ce1096f) Co-authored-by: Michael <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]> [Google LLC]
…er (python#93324) Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`. --------- Co-authored-by: Gregory P. Smith <[email protected]> [Google LLC]
…er (python#93324) Omit the `@interface_scope` from an IPv6 address when used as Host header by `http.client`. --------- Co-authored-by: Gregory P. Smith <[email protected]> [Google LLC]
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: