Skip to content
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

PartialEq/Ord impls for Authority ignores case of userinfo part #625

Open
tesaguri opened this issue Sep 18, 2023 · 0 comments
Open

PartialEq/Ord impls for Authority ignores case of userinfo part #625

tesaguri opened this issue Sep 18, 2023 · 0 comments

Comments

@tesaguri
Copy link
Contributor

The comparison traits are implemented for http::uri::Authority by case-insensitively comparing the underlying authority string. This works fine if the authority component only consists of the host subcomponent (and optionally the port subcomponent), which is case-insensitive according to RFC 3986 Section 6.2.2.1.

However, the authority component may also contain a (deprecated according to RFC 9110 Section 4.2.4.) userinfo subcomponent, which is not specified to be case-insensitive and thus should be compared case-sensitively. In particular, the following test should pass:

use http::uri::Authority;

#[test]
fn userinfo_eq_case_sensitive() {
    assert_ne!(
        Authority::from_static("alice:supersecurepassword@example.com"),
        Authority::from_static("Alice:SuperSecurePassword@example.com")
    );
}

But this fails with the current implementation.

Is the behavior intentional? I understand that complicating the implementation for the deprecated subcomponent might not be desirable. But I think this should at least be documented if it's intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant