You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The port number from a URL should not be left tacked on the end of the host when parsing a URL into a url.URL struct. Instead, the port number should be pulled out and added to a url.URL.Port field. Leaving the port in a parsed hostname invariably leaves developers calling strings.Split(url.URL.Host, ":")[0] repeatedly to get the hostname.
The text was updated successfully, but these errors were encountered:
First of all, port is part of the host in RFC 2616.
And more importantly, this is a backward incompatible change, so
even if we want to add a Port field to net/url.URL, we can't.
mikioh
changed the title
net/url url.URL should parse the port number and store it separately
net/url: URL should parse the port number and store it separately
Mar 27, 2015
The port number from a URL should not be left tacked on the end of the host when parsing a URL into a
url.URL
struct. Instead, the port number should be pulled out and added to aurl.URL.Port
field. Leaving the port in a parsed hostname invariably leaves developers callingstrings.Split(url.URL.Host, ":")[0]
repeatedly to get the hostname.The text was updated successfully, but these errors were encountered: