-
Notifications
You must be signed in to change notification settings - Fork 330
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
Calling port()
with a default port returns None unexpectedly
#957
Comments
I would think the docs are pretty clear on this issue. https://docs.rs/url/2.5.2/url/struct.Url.html#method.port You want Note that changing the behaviour of port is a breaking change, and not something we'd consider doing at the moment. |
Can you add another API that returns I need to distinguish between these cases because when user scans a QR code, in the first case this is likely an HTTPS proxy URL and in the second case it is likely a normal URL that I want to offer to open in a browser: As a workaround I will now try to look at |
Another way to fix this would be to add an option to |
As a workaround I now replace |
Describe the bug
related to #28
This was an issue way back in 2014, but doesn't seem like it was ever really addressed.
I would expect calling
port()
onhttp://example.com
to return 80. It is really confusing that it would return a None. It's even worse when you set the port explicitlyhttp://example.com:80
and it still seems like it isn't working correctly because it still returns None.I could update the docs to have an example of the port being ignored, but it seems like it would just make more sense to have
port()
actually return the port and do what is suggested in this commentThe text was updated successfully, but these errors were encountered: