Repository navigation
[3.14] gh-53089: Send uri="/" in Digest auth for URLs with an empty path (GH-161009) - #161014
Merged
Merged
Conversation
…th (pythonGH-161009) For a URL such as http://example.com, the request selector is empty. AbstractDigestAuthHandler.get_authorization() used it as-is, sending uri="" and hashing "GET:" while http.client sends "GET /" on the request line, so servers rejected the request or failed the digest check. Normalize an empty selector to '/', as http.client does, for both the uri field and A2. Also replace the long-standing "XXX selector: what about proxies and full urls" note with a comment explaining that the digest-uri is the request-target as sent (absolute-form through an HTTP proxy), which RFC 7616 allows, and add a test pinning that behavior. (cherry picked from commit 663e99d) Co-authored-by: Senthil Kumaran <senthil@python.org> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
orsenthil
approved these changes
Oct 31, 2026
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.
For a URL such as http://example.com, the request selector is empty.
AbstractDigestAuthHandler.get_authorization() used it as-is, sending
uri="" and hashing "GET:" while http.client sends "GET /" on the
request line, so servers rejected the request or failed the digest
check. Normalize an empty selector to '/', as http.client does, for
both the uri field and A2.
Also replace the long-standing "XXX selector: what about proxies and
full urls" note with a comment explaining that the digest-uri is the
request-target as sent (absolute-form through an HTTP proxy), which
RFC 7616 allows, and add a test pinning that behavior.
(cherry picked from commit 663e99d)
Co-authored-by: Senthil Kumaran senthil@python.org
Co-authored-by: Claude Opus 5.5 noreply@anthropic.com