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
net/url: Parse returns URL whose Host contains colon #25511
Comments
While you are correct about : being invalid, the URL.Host allows host:port which is why the : is present. |
Every time we change the URL package we break tons of code. That might not happen in this case, but we've said that dozens of times before. So I'd rather not change anything here. We don't strictly follow the RFCs for legacy reasons. There would need to be a good reason to change something here. I also note that if I copy/paste these into Chrome, it works fine:
(note the colons in the authority with an empty port) I also note that this doesn't break the Port method on URL: https://play.golang.org/p/I3OO4NvwBTb So what do we gain by changing something? |
The issue comes up when I use proxy for
And run it with
Line 299 in 65c365b
Then http will try to connect to socks5h: .Maybe it is better to handle this in http package. #24135
|
For According to https://tools.ietf.org/html/rfc3986#section-6.2.3 |
I just found that |
Sounds like we should close this then? |
What version of Go are you using (
go version
)?1.10.2 and tip(5776bd5)
Does this issue reproduce with the latest release?
Yes
What did you do?
https://play.golang.org/p/vYNt0qipkxf
Parse an invalid URL,
http://socks5h://server
What did you see?
&url.URL{Scheme:"http", Host:"socks5h:", Path:"//server"}
What did you expect to see?
An error.
As per https://tools.ietf.org/html/rfc3986#section-3.2.2, host can't contain
:
The text was updated successfully, but these errors were encountered: