Repository navigation
Fix Authority comparison ignoring userinfo case - #891
Open
draarivpatel-ui wants to merge 1 commit into
Open
draarivpatel-ui wants to merge 1 commit into
draarivpatel-ui wants to merge 1 commit into
Conversation
The PartialEq, PartialOrd and Hash implementations for Authority compared the entire authority string case-insensitively. Per RFC 3986 Section 6.2.2.1 only the host subcomponent is case-insensitive; the userinfo subcomponent is case-sensitive, so two authorities differing only in userinfo case must not compare equal. Split the authority at the userinfo delimiter for equality, ordering and hashing: userinfo is compared and hashed byte-wise, the remainder case-insensitively as before. Fixes hyperium#625
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This branch has not been deployed
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.
Summary
PartialEq,PartialOrd, andHashforhttp::uri::Authoritycompared the entire authority string case-insensitively. Per RFC 3986 Section 6.2.2.1 only the host subcomponent is case-insensitive; the userinfo subcomponent is case-sensitive, so authorities differing only in userinfo case must not compare equal.Change
Comparisons and hashing now split the authority at the userinfo delimiter (the last
@, which cannot appear unencoded in a valid host):Hashis updated to stay consistent withPartialEqAll
Authority/str/&str/Stringcomparison impls route through the same helpers so cross-type comparisons behave identically.Test plan
cargo testpasses (152 lib + 228 doc + integration tests),cargo fmt --checkcleanFixes #625