dc74f51c43
The net package uses various textual representations for network identifiers and locators on the Internet protocol suite as API. In fact, the representations are the composition of subset of multple RFCs: RFC 3986, RFC 4007, RFC 4632, RFC 4291 and RFC 5952. RFC 4007 describes guidelines for the use of textual representation of IPv6 addressing/routing scope zone and doesn't prohibit the format for implementation dependent purposes, as in, specifying a literal IPv6 address and its connected region of routing topology as application user interface. However, a non-literal IPv6 address, for example, a host name, with a zone enclosed in square brackets confuses us because a zone is basically for non-global IPv6 addresses and a pair of square brackets is used as a set of delimiters between a literal IPv6 address and a service name or transport port number. To mitigate such confusion, this change makes JoinHostPort not enclose non-literal IPv6 addresses in square brackets and SplitHostPort accept the form "host%zone:port" to recommend that anything enclosed in square brackets should be a literal IPv6 address. Before this change: JoinHostPort("name%zone", "80") = "[name%zone]:80" JoinHostPort("[::1%zone]", "80") = "[::1%zone]:80" SplitHostPort("name%zone:80") = "", "", "address name%zone:80: missing brackets in address" SplitHostPort("[name%zone]:80") = "name%zone", "80", nil SplitHostPort("[::1%zone]:80") = "::1%zone", "80", nil After this change: JoinHostPort("name%zone", "80") = "name%zone:80" JoinHostPort("[::1%zone]", "80") = "[::1%zone]:80" SplitHostPort("name%zone:80") = "name%zone", "80", nil SplitHostPort("[name%zone]:80") = "name%zone", "80", nil // for backwards compatibility SplitHostPort("[::1%zone]:80") = "::1%zone", "80", nil Also updates docs and test cases on SplitHostPort and JoinHostPort for clarification. Fixes #18059. Fixes #18060. Change-Id: I5c3ccce4fa0fbdd58f698fc280635ea4a14d2a37 Reviewed-on: https://go-review.googlesource.com/40510 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Contributing
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project does not use GitHub pull requests, and that we use the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.