Preserve IPv6 zone identifier in prepared URLs (#6735)#7388
Open
Preserve IPv6 zone identifier in prepared URLs (#6735)#7388
Conversation
requote_uri percent-encodes the literal '%' zone-id separator to '%25',
which urllib3 then forwards verbatim to getaddrinfo(). The kernel cannot
resolve a zone literally named '%25eth0', so link-local IPv6 URLs such
as https://[fe80::1%ens192]/ fail with [Errno -2] Name or service not
known since requests 2.32.0.
Restore the literal '%' inside the bracketed host after requoting.
urllib3.util.parse_url already normalizes both the literal ('%eth0')
and RFC 6874 ('%25eth0') forms to the literal form, so we only need
to undo the re-encoding that requote_uri performs on the authority.
Fixes psf#6735.
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6735.
Problem
Since requests 2.32.0, requesting a link-local IPv6 URL such as