-
Notifications
You must be signed in to change notification settings - Fork 155
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
Port normalization #921
Comments
Related issue that should also be fixed with this one: aio-libs/aiohttp#7381 |
Had a look, I'd consider 2 scenarios. Dropping the port in What would you prefer? |
Well, I don't think you want to drop it ( |
Is your feature request related to a problem?
I'm planning on including yarl as a dependency in the referencing project, which essentially needs to maintain an object of type
Mapping[URL, Foo]
.As part of doing so, I want/need URLs to be normalized according to RFC3986 so that users looking up "equivalent" URLs get the same
Foo
.This works perfectly for everything except port normalization. In other words, if a URL contains a default port, the following returns
False
:URL('http://example.com:80/default/port') == URL('http://example.com/default/port')
even though these URLs are equivalent, and even though it seems yarl knows about some default ports.This means that when doing lookups or insertions, I have to first manually do:
Describe the solution you'd like
Strip default ports on creation, similar to what
hyperlink.URL
does, where:returns
True
.Describe alternatives you've considered
Provide a
.normalize
method, though this seems odd given that all other normalization is done already for me (e.g. percentage escapes, case sensitivity or insensitivity, etc.)Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: