Description
(Fork of http://thread.gmane.org/gmane.comp.lang.go.devel/101215)
net/url and net/http say nothing about whose responsibility it is to map non-ASCII hostnames to/from Punycode.
Whose is it?
I was going to fix #13686 for Go 1.6 by vendoring the golang.org/x/net/idna package and using ToASCII when sending HTTP requests (when writing the Host header) in the HTTP client code.
But should I also use ToUnicode when reading Host lines in the HTTP server code? Or should I leave the url.URL.Host string in Punycode form?
@nigeltao said:
I don't know whose responsibility it is, but FWIW, the
PublicSuffixList.PublicSuffix doc comment at the top of
https://go.googlesource.com/go/+/master/src/net/http/cookiejar/jar.go
also has a TODO to decide whose responsibility it is.Some canonicalization is also done by
https://go.googlesource.com/go/+/master/src/net/http/cookiejar/punycode.go
which is a copy/paste of the x/net/idna code. Or maybe x/net/idna is
the copy/paste and net/http/cookiejar is the original. I forget.
We should figure this out for Go 1.7.
Should net.Dial work on UTF-8 domain names?
Should url.Parse decode them into URL.Host? Should URL.Host accept either UTF-8 or Punycode?
Should Punycode be exposed in the stdlib?