go/src
Mikio Hara dc74f51c43 net: don't enclose non-literal IPv6 addresses in square brackets
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>
2017-04-14 08:44:22 +00:00
..
archive archive/zip: parallelize benchmarks 2017-03-15 18:26:51 +00:00
bufio
builtin
bytes strings: optimize Count for amd64 2017-04-07 14:25:13 +00:00
cmd cmd/dist: fix incorrect platform string shared by all tests 2017-04-14 03:15:59 +00:00
compress Revert "all: test adjustments for the iOS builder" 2017-03-04 00:01:14 +00:00
container
context all: fix minor misspellings 2017-04-03 23:19:07 +00:00
crypto crypto/aes: fix wrong instruction on ppc64le implementation 2017-04-11 20:10:08 +00:00
database/sql database/sql: correctly guard the query Row preventing early release 2017-04-12 17:36:26 +00:00
debug debug/pe: add TestBuildingWindowsGUI 2017-03-30 01:19:57 +00:00
encoding encoding/asn1: support 31 bit identifiers with OID 2017-04-13 00:49:49 +00:00
errors
expvar expvar: add benchmark for (*Map).Set with per-goroutine keys 2017-03-10 19:09:48 +00:00
flag flag: validate Int and Uint values to be in range 2017-03-21 17:00:26 +00:00
fmt fmt: add short note about %g precision 2017-02-21 19:02:43 +00:00
go net/http/fcgi: expose cgi env vars in request context 2017-04-13 04:38:23 +00:00
hash hash/crc32: optimize arm64 crc32 implementation 2017-04-13 12:44:10 +00:00
html html/template: panic if predefined escapers are found in pipelines during rewriting 2017-04-10 15:08:47 +00:00
image image/png: decode Gray8 transparent images. 2017-03-17 07:50:05 +00:00
index/suffixarray
internal internal/poll: rename RecvFrom to ReadFrom for consistency 2017-04-13 03:26:58 +00:00
io
log
math math/bits: support negative rotation count and remove RotateRight 2017-04-11 23:57:24 +00:00
mime mime: fix panic parsing 'encoded-word' 2017-04-09 19:03:00 +00:00
net net: don't enclose non-literal IPv6 addresses in square brackets 2017-04-14 08:44:22 +00:00
os os: handle relative symlinks starting with slash in Stat on windows 2017-04-12 23:33:11 +00:00
path path/filepath: add test to walk symlink 2017-04-05 02:31:45 +00:00
plugin plugin: resolve random crash when calling exported functions 2017-04-12 12:34:25 +00:00
reflect reflect: add MakeMapWithSize for creating maps with size hint 2017-04-04 20:01:43 +00:00
regexp regexp: document that Longest method is not concurrent-safe 2017-04-07 21:12:11 +00:00
runtime runtime: free workbufs during sweeping 2017-04-13 18:20:47 +00:00
sort sort: new example: Sorting slices with sort.SliceStable 2017-02-22 21:23:12 +00:00
strconv strconv: optimize decimal ints formatting with smallsString 2017-03-22 16:03:28 +00:00
strings strings: optimize Count for amd64 2017-04-07 14:25:13 +00:00
sync sync/atomic: fix mipsx frame sizes 2017-02-21 18:42:47 +00:00
syscall syscall: fix TestGroupCleanup{UserNamespace} on Alpine 2017-04-13 22:47:55 +00:00
testing testing: document example with unordered output 2017-04-10 19:55:45 +00:00
text text/template: fix handling of empty blocks 2017-04-04 15:46:02 +00:00
time testing/quick: generate all possible int64, uint64 values 2017-04-03 14:01:25 +00:00
unicode
unsafe
vendor/golang_org/x net/http: import updated idna package and adjust request.go 2017-03-24 13:30:17 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash src/*.bash: use tabs consistently 2017-03-09 21:30:31 +00:00
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
make.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
make.bat
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
run.bat
run.rc