1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:08:37 -07:00
Commit Graph

2103 Commits

Author SHA1 Message Date
Xiangdong Ji
f9d50953b9 net: fix failure of TestCVE202133195
TestCVE202133195 fails in testing LookupSRV if /etc/resolv.conf sets the option
'ndots' larger than the number of dots in the domain name under query.

Fix the issue by making the input domain name in test codes 'rooted' to skip search
list qualifying.

Fixes #46955

Change-Id: I1909fa7e54e9c9af57623e57cafc905729ff99fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/330842
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-29 21:54:24 +00:00
Bryan C. Mills
a9bb38222a net: remove hard-coded timeout in dialClosedPort test helper
The helper function claims that dialing a closed port should be
"nearly instantaneous", but that is empirically not the case on
OpenBSD or Windows. The tests do not appear to be particularly
sensitive to the exact upper bound otherwise, so let's just
remove the arbitrary latency assumption.

Fixes #46884

Change-Id: If00c9fdc3063da6aaf60d365d4a2ee2c94dc6df1
Reviewed-on: https://go-review.googlesource.com/c/go/+/330250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-24 03:45:33 +00:00
Bryan C. Mills
73496e0df0 net: use absDomainName in the Windows lookupPTR test helper
The real net code uses subtle heuristics to transform a domain name
to its absolute form. Since lookupPTR isn't checking that
transformation specifically, it should use the real code instead of
using a different heuristic.

Fixes #46882

Change-Id: I503357e0f62059c37c359cd54b44d343c7d5ab2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/330249
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-24 00:39:41 +00:00
Filippo Valsorda
d77f4c0c5c net/http: improve some server docs
Change-Id: I04662a08e07c49f629f9067a89bf453e697d44dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/327813
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-06-15 20:59:42 +00:00
Damien Neil
770f1de8c5 net/http: remove test-only private key from production binaries
The net/http/internal package contains a PEM-encoded private key used in
tests. This key is initialized at init time, which prevents it from
being stripped by the linker in non-test binaries.

Move the certificate and key to a new net/http/internal/testcert
package to ensure it is only included in binaries that reference it.

Fixes #46677.

Change-Id: Ie98bda529169314cc791063e7ce4d99ef99113c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/326771
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-06-10 20:20:58 +00:00
Filippo Valsorda
e4e7807d24 net/http: add AllowQuerySemicolons
Fixes #45973

Change-Id: I6cbe05f5d1d3c324900c74314b0ea0e12524d7f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/326309
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-09 16:59:02 +00:00
Katie Hockman
e6dda19888 net/url: reject query values with semicolons
Semicolons are no longer valid separators, so
net/url.ParseQuery will now return an error
if any part of the query contains a semicolon.

net/http.(*Request).ParseMultipartForm has been
changed to fall through and continue parsing
even if the call to (*Request).ParseForm fails.

This change also includes a few minor refactors
to existing tests.

Fixes #25192

Change-Id: Iba3f108950fb99b9288e402c41fe71ca3a2ababd
Reviewed-on: https://go-review.googlesource.com/c/go/+/325697
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-06-09 15:44:42 +00:00
Roland Shoemaker
d3e3d03666 net: reject leading zeros in IP address parsers
In both net.ParseIP and net.ParseCIDR reject leading zeros in the
dot-decimal notation of IPv4 addresses.

Fixes #30999
Fixes #43389

Change-Id: I2b6a31fe84db89ac828cf5ed03eaa586ee96ab68
Reviewed-on: https://go-review.googlesource.com/c/go/+/325829
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-08 20:23:22 +00:00
Damien Neil
831f9376d8 net/http: fix ResponseWriter.ReadFrom with short reads
CL 249238 changes ResponseWriter.ReadFrom to probe the source with
a single read of sniffLen bytes before writing the response header.
If the source returns less than sniffLen bytes without reaching
EOF, this can cause Content-Type and Content-Length detection to
fail.

Fix ResponseWrite.ReadFrom to copy a full sniffLen bytes from
the source as a probe.

Drop the explicit call to w.WriteHeader; writing the probe will
trigger a WriteHeader call.

Consistently use io.CopyBuffer; ReadFrom has already acquired a
copy buffer, so it may as well use it.

Fixes #44953.

Change-Id: Ic49305fb827a2bd7da4764b68d64b797b5157dc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/301449
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-06-04 17:33:24 +00:00
Roland Shoemaker
dd7ba3ba2c net: don't rely on system hosts in TestCVE202133195
Also don't unnecessarily deref the error return.

Fixes #46504

Change-Id: I22d14ac76776f8988fa0774bdcb5fcd801ce0185
Reviewed-on: https://go-review.googlesource.com/c/go/+/324190
Trust: David Chase <drchase@google.com>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-06-02 21:39:28 +00:00
Manlio Perillo
193d514131 net/http: correct Client.Do doc about context cancelation
The documentation of the Client.Do method and Get function incorrectly
stated that, in case of context cancelation, the returned url.Error
Timeout method returns true.

Update the documentation to correctly match the implementation.
See also CL 200798 that, due to an oversight, corrected only the
documentation of the Client.Get method.

Remove a TODO note added in CL 125575 (net/http: document that Client
methods always return *url.Error), since it is no longer applicable
after CL 200798 (net/http: fix and lock-in Client.Do docs on request
cancelation).

Fixes #46402

Change-Id: Ied2ee971ba22b61777762dbb19f16e08686634ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/323089
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-05-27 21:41:58 +00:00
Roland Shoemaker
cdcd02842d net: verify results from Lookup* are valid domain names
For the methods LookupCNAME, LookupSRV, LookupMX, LookupNS, and
LookupAddr check that the returned domain names are in fact valid DNS
names using the existing isDomainName function.

Thanks to Philipp Jeitner and Haya Shulman from Fraunhofer SIT for
reporting this issue.

Fixes #46241
Fixes CVE-2021-33195

Change-Id: I47a4f58c031cb752f732e88bbdae7f819f0af4f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/323131
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-27 19:55:46 +00:00
Roland Shoemaker
fca7b8f3e6 Revert "net: verify results from Lookup* are valid domain names"
This reverts commit c89f1224a5.

Reason for revert: reverting so we can apply follow-up fixes and do a single cherry pick.

Change-Id: I16c6283a0bcab056216f330fb98fa3b5f2b0780c
Reviewed-on: https://go-review.googlesource.com/c/go/+/323129
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-27 15:33:46 +00:00
Filippo Valsorda
950fa11c4c net/http/httputil: always remove hop-by-hop headers
Previously, we'd fail to remove the Connection header from a request
like this:

    Connection:
    Connection: x-header

Fixes #46313
Fixes CVE-2021-33197

Change-Id: Ie3009e926ceecfa86dfa6bcc6fe14ff01086be7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/321929
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-27 15:00:58 +00:00
Roland Shoemaker
c89f1224a5 net: verify results from Lookup* are valid domain names
For the methods LookupCNAME, LookupSRV, LookupMX, LookupNS, and
LookupAddr check that the returned domain names are in fact valid DNS
names using the existing isDomainName function.

Thanks to Philipp Jeitner and Haya Shulman from Fraunhofer SIT for
reporting this issue.

Fixes #46241
Fixes CVE-2021-33195

Change-Id: Icf231acd93178a3b6aec3f178cff7e693f74ef8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/320949
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-24 22:27:31 +00:00
Dmitri Shuralyov
6c1c055d1e cmd/internal/moddeps: use filepath.SkipDir only on directories
If a filepath.WalkFunc returns filepath.SkipDir when invoked on a
non-directory file, it skips the remaining files in the containing
directory.¹

CL 276272 accidentally added a code path that triggers this behavior
whenever filepath.Walk reaches a non-directory file that begins with
a dot, such as .gitattributes or .DS_Store, causing findGorootModules
to return early without finding any modules in GOROOT. Tests that use
it ceased to provide test coverage that the tree is tidy.

Add an explicit check for info.IsDir in the 5 places that intend to
use filepath.SkipDir to skip traversing that directory. Even paths
like GOROOT/bin and GOROOT/pkg which are unlikely to be anything but
a directory are worth checking, since the goal of moddeps is to take
a possibly problematic GOROOT tree as input and detect problems.

While the goal of findGorootModules is to find all modules in GOROOT
programmatically (in case new modules are added or modified), there
are 4 modules now that are quite likely to exist, so check for their
presence to avoid similar regressions. (It's not hard to update this
test if a well-known GOROOT module is removed or otherwise modified;
but if it becomes hard we can simplify it to check for a reasonable
number of modules instead.)

Also fix the minor skew that has crept in since the test got disabled.

¹ This wasn't necessarily an intentional design decision, but it was
  found only when Go 1.4 was already out. See CL 11690 for details.

Fixes #46254.

Change-Id: Id55ed926f8c0094b1af923070de72bacca05996f
Reviewed-on: https://go-review.googlesource.com/c/go/+/320991
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-05-19 15:20:08 +00:00
Michael Pratt
658b5e66ec net: return nil UDPAddr from ReadFromUDP
In cases where the socket operation has no underlying address,
golang.org/cl/291509 unintentionally changed ReadFromUDP from return a
nil *UDPAddr to a non-nil (but zero value) *UDPAddr.

This may break callers that assume "no address" is always addr == nil,
so change it back to remain nil.

Fixes #46238

Change-Id: I8531e8fa16b853ed7560088eabda0b9e3e53f5be
Reviewed-on: https://go-review.googlesource.com/c/go/+/320909
Trust: Michael Pratt <mpratt@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-05-19 13:04:45 +00:00
Michael Fraenkel
3d324f127d net/http: prevent infinite wait during TestMissingStatusNoPanic
If the client request never makes it to the server, the outstanding
accept is never broken. Change the test to always close the listening
socket when the client request completes.

Updates #45358

Change-Id: I744a91dfa11704e7e528163d7669c394e90456dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/319275
Trust: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-14 16:42:01 +00:00
John Bampton
3a0453514a all: fix spelling
Change-Id: Id991d8e81e04835cabfb02d07a2199bfb553726c
GitHub-Last-Rev: 5d0b55d491
GitHub-Pull-Request: golang/go#44802
Reviewed-on: https://go-review.googlesource.com/c/go/+/299069
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
2021-05-14 00:56:24 +00:00
Filippo Valsorda
9b84814f6e net/http: check that Unicode-aware functions are not used
Change-Id: I398aff06bec95077bfff02bfb067aa949b70c184
Reviewed-on: https://go-review.googlesource.com/c/go/+/318429
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roberto Clapis <roberto@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
2021-05-11 18:22:54 +00:00
Roberto Clapis
5c489514bc net/http: switch HTTP1 to ASCII equivalents of string functions
The current implementation uses UTF-aware functions
like strings.EqualFold and strings.ToLower.

This could, in some cases, cause http smuggling.

Change-Id: I0e76a993470a1e1b1b472f4b2859ea0a2b22ada0
Reviewed-on: https://go-review.googlesource.com/c/go/+/308009
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Roberto Clapis <roberto@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-05-10 23:42:56 +00:00
Tobias Klauser
82517acae8 net, runtime: drop macOS 10.12 skip conditions in tests
Go 1.17 requires macOS 10.13 or later. Thus, drop the special cases for
the darwin-amd64-10_12 builder added in CL 202618.

Updates #22019
Updates #23011
Updates #32919

Change-Id: Idef11c213dfb25fd002b7cda6d425cf2e26a2e06
Reviewed-on: https://go-review.googlesource.com/c/go/+/318329
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-10 15:49:50 +00:00
Katie Hockman
784ef4c531 net/http: ignore directory path when parsing multipart forms
Fixes #45789

Change-Id: Id588f5dbbecf5fbfb54e957c53903aaa900171f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/313809
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-05-05 18:14:49 +00:00
Alexander Rakoczy
f34fe8e370 all: update vendored dependencies for Go 1.17
The Go 1.17 freeze has begun. This is a time to update all
golang.org/x/...  module versions that contribute packages to the std
and cmd modules in the standard library to latest master versions.

	updatestd --branch master --goroot=$HOME/development/goroot
	> go version
	go version devel go1.17-4c9791299d Wed May 5 09:00:06 2021 +0000 linux/amd64
	> go env GOROOT
	/home/rakoczy/development/goroot
	> go version -m /home/rakoczy/go/bin/bundle
	/home/rakoczy/go/bin/bundle: devel +c584f42dcf Tue Feb 23 18:39:53 2021 +0000
		path	golang.org/x/tools/cmd/bundle
		mod	golang.org/x/tools	v0.1.0	h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
		dep	golang.org/x/mod	v0.3.0	h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
		dep	golang.org/x/sys	v0.0.0-20210119212857-b64e53b001e4	h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
		dep	golang.org/x/xerrors	v0.0.0-20200804184101-5ec99f83aff1	h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=

	skipping github.com/chzyer/logex (out of scope, it's not a golang.org/x dependency)
	skipping github.com/chzyer/readline (out of scope, it's not a golang.org/x dependency)
	skipping github.com/chzyer/test (out of scope, it's not a golang.org/x dependency)
	skipping github.com/google/pprof (out of scope, it's not a golang.org/x dependency)
	skipping github.com/ianlancetaylor/demangle (out of scope, it's not a golang.org/x dependency)
	skipping github.com/yuin/goldmark (out of scope, it's not a golang.org/x dependency)
	skipping rsc.io/pdf (out of scope, it's not a golang.org/x dependency)
	updating module cmd in /home/rakoczy/development/goroot/src/cmd
	> go mod edit -go=1.17
	> go get -d golang.org/x/arch@cbf565b21d1e6f86b3114f28f516032b201c97fa golang.org/x/crypto@e9a32991a82ef02a1e74f495dcc0785239782bfe golang.org/x/mod@67f1c1edc27ada9b0cffe84ccdd4db2d4ff56edf golang.org/x/net@0287a6fb4125c2b83c66560a2677a4ee69a13903 golang.org/x/sync@036812b2e83c0ddf193dd5a34e034151da389d09 golang.org/x/sys@0981d6026fa6241c75c6949829b5bd7a2574ad55 golang.org/x/term@a79de5458b56c188f4fc267a58014ac25fec956a golang.org/x/text@5c7c50ebbd4f5b0d53b9b2fcdbeb92ffb732a06e golang.org/x/tools@7cab0ef2e9a592f6a73e7a1969ba89d38515e143 golang.org/x/xerrors@5ec99f83aff198f5fbd629d6c8d8eb38a04218ca
	go: downloading golang.org/x/mod v0.4.3-0.20210504181020-67f1c1edc27a
	go: downloading golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e
	go: downloading golang.org/x/net v0.0.0-20210505024714-0287a6fb4125
	go: downloading golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6
	go: downloading golang.org/x/text v0.3.7-0.20210503195748-5c7c50ebbd4f
	go: downloading golang.org/x/tools v0.1.1-0.20210505014545-7cab0ef2e9a5
	go get: upgraded golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 => v0.0.0-20210505024714-0287a6fb4125
	go get: upgraded golang.org/x/sys v0.0.0-20210423082822-04245dca01da => v0.0.0-20210503173754-0981d6026fa6
	go get: upgraded golang.org/x/text v0.3.3 => v0.3.7-0.20210503195748-5c7c50ebbd4f
	go get: upgraded golang.org/x/tools v0.1.1-0.20210503200558-19b1717ea5eb => v0.1.1-0.20210505014545-7cab0ef2e9a5
	> go mod tidy
	> go mod vendor

	updating module std in /home/rakoczy/development/goroot/src
	> go mod edit -go=1.17
	> go get -d golang.org/x/crypto@e9a32991a82ef02a1e74f495dcc0785239782bfe golang.org/x/net@0287a6fb4125c2b83c66560a2677a4ee69a13903 golang.org/x/sys@0981d6026fa6241c75c6949829b5bd7a2574ad55 golang.org/x/term@a79de5458b56c188f4fc267a58014ac25fec956a golang.org/x/text@5c7c50ebbd4f5b0d53b9b2fcdbeb92ffb732a06e golang.org/x/tools@7cab0ef2e9a592f6a73e7a1969ba89d38515e143
	go get: upgraded golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 => v0.0.0-20210505024714-0287a6fb4125
	go get: upgraded golang.org/x/sys v0.0.0-20210423082822-04245dca01da => v0.0.0-20210503173754-0981d6026fa6
	go get: upgraded golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 => v0.0.0-20210503060354-a79de5458b56
	go get: upgraded golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e => v0.1.1-0.20210505014545-7cab0ef2e9a5
	> go mod tidy
	> go mod vendor

	updating bundles in /home/rakoczy/development/goroot/src
	> go generate -run=bundle std cmd

For #36905

Change-Id: Ie145bba93125f0b4212df94216e05ec08c4fe534
Reviewed-on: https://go-review.googlesource.com/c/go/+/315831
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-05 15:53:03 +00:00
Ian Lance Taylor
371ea545c0 net/url: avoid string concatenation in resolvePath
ame                  old time/op    new time/op    delta
String-12               8.09µs ± 7%    8.20µs ± 5%     ~     (p=0.347 n=20+19)
ResolvePath-12           223ns ± 8%     170ns ± 7%  -23.84%  (p=0.000 n=20+19)
QueryEscape/#00-12      72.9ns ± 5%    73.6ns ± 6%     ~     (p=0.337 n=20+20)
QueryEscape/#01-12       467ns ± 5%     467ns ± 7%     ~     (p=0.612 n=19+20)
QueryEscape/#02-12       257ns ± 8%     262ns ± 8%     ~     (p=0.080 n=20+20)
QueryEscape/#03-12       553ns ±12%     568ns ± 8%   +2.73%  (p=0.048 n=20+19)
QueryEscape/#04-12      4.45µs ± 7%    4.52µs ± 5%     ~     (p=0.163 n=20+20)
PathEscape/#00-12        119ns ± 9%     121ns ± 6%     ~     (p=0.140 n=20+20)
PathEscape/#01-12        458ns ± 7%     483ns ± 4%   +5.49%  (p=0.000 n=20+20)
PathEscape/#02-12        255ns ± 7%     257ns ± 7%     ~     (p=0.560 n=20+20)
PathEscape/#03-12        556ns ± 8%     559ns ± 8%     ~     (p=0.799 n=20+20)
PathEscape/#04-12       4.14µs ± 6%    4.28µs ± 8%   +3.30%  (p=0.003 n=20+20)
QueryUnescape/#00-12    72.2ns ± 8%    74.9ns ± 5%   +3.66%  (p=0.006 n=20+19)
QueryUnescape/#01-12     223ns ± 7%     230ns ± 8%   +2.84%  (p=0.016 n=20+20)
QueryUnescape/#02-12     200ns ± 7%     203ns ±10%     ~     (p=0.533 n=20+20)
QueryUnescape/#03-12     480ns ± 7%     500ns ± 8%   +4.15%  (p=0.006 n=20+20)
QueryUnescape/#04-12    2.61µs ± 8%    2.70µs ± 7%   +3.39%  (p=0.009 n=20+20)
PathUnescape/#00-12     74.6ns ± 6%    75.4ns ± 6%     ~     (p=0.425 n=20+20)
PathUnescape/#01-12      226ns ± 3%     227ns ± 8%     ~     (p=0.453 n=15+20)
PathUnescape/#02-12      202ns ±11%     202ns ± 6%     ~     (p=0.963 n=20+20)
PathUnescape/#03-12      484ns ± 9%     494ns ± 9%     ~     (p=0.078 n=20+19)
PathUnescape/#04-12     2.60µs ± 6%    2.61µs ± 8%     ~     (p=0.776 n=20+19)
Split-12                6.47ns ± 0%    6.47ns ± 0%     ~     (p=0.760 n=18+18)

name                  old alloc/op   new alloc/op   delta
String-12               1.50kB ± 0%    1.50kB ± 0%     ~     (all equal)
ResolvePath-12           24.0B ± 0%     16.0B ± 0%  -33.33%  (p=0.000 n=20+20)
QueryEscape/#00-12       8.00B ± 0%     8.00B ± 0%     ~     (all equal)
QueryEscape/#01-12       64.0B ± 0%     64.0B ± 0%     ~     (all equal)
QueryEscape/#02-12       32.0B ± 0%     32.0B ± 0%     ~     (all equal)
QueryEscape/#03-12       64.0B ± 0%     64.0B ± 0%     ~     (all equal)
QueryEscape/#04-12        832B ± 0%      832B ± 0%     ~     (all equal)
PathEscape/#00-12        16.0B ± 0%     16.0B ± 0%     ~     (all equal)
PathEscape/#01-12        64.0B ± 0%     64.0B ± 0%     ~     (all equal)
PathEscape/#02-12        32.0B ± 0%     32.0B ± 0%     ~     (all equal)
PathEscape/#03-12        64.0B ± 0%     64.0B ± 0%     ~     (all equal)
PathEscape/#04-12         704B ± 0%      704B ± 0%     ~     (all equal)
QueryUnescape/#00-12     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
QueryUnescape/#01-12     24.0B ± 0%     24.0B ± 0%     ~     (all equal)
QueryUnescape/#02-12     24.0B ± 0%     24.0B ± 0%     ~     (all equal)
QueryUnescape/#03-12     64.0B ± 0%     64.0B ± 0%     ~     (all equal)
QueryUnescape/#04-12      320B ± 0%      320B ± 0%     ~     (all equal)
PathUnescape/#00-12      8.00B ± 0%     8.00B ± 0%     ~     (all equal)
PathUnescape/#01-12      24.0B ± 0%     24.0B ± 0%     ~     (all equal)
PathUnescape/#02-12      24.0B ± 0%     24.0B ± 0%     ~     (all equal)
PathUnescape/#03-12      64.0B ± 0%     64.0B ± 0%     ~     (all equal)
PathUnescape/#04-12       320B ± 0%      320B ± 0%     ~     (all equal)

name                  old allocs/op  new allocs/op  delta
String-12                 63.0 ± 0%      63.0 ± 0%     ~     (all equal)
ResolvePath-12            3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=20+20)
QueryEscape/#00-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#01-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#02-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#03-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#04-12        2.00 ± 0%      2.00 ± 0%     ~     (all equal)
PathEscape/#00-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#01-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#02-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#03-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#04-12         2.00 ± 0%      2.00 ± 0%     ~     (all equal)
QueryUnescape/#00-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#01-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#02-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#03-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#04-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#00-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#01-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#02-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#03-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#04-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Fixes #43587

Change-Id: I66c47e78e92555180ce3554a2d4a21038362c41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/282673
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-05-04 16:10:58 +00:00
Roland Shoemaker
b584230889 net/http: use relative path in Location redirect
If the cleaned path did not match the requested path, ServeMux.Handler
would return a Location header which reflected the hostname in the
request, possibly leading to an incorrect redirect. Instead the
Location header should be relative, like the other cases in
ServeMux.Handler.

Change-Id: I2c220d925e708061bc128f0bdc96cca7a32764d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/313950
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-03 17:34:10 +00:00
Ian Mckay
a893682d83 net/url: add Values.Has
Adds a method within Values for detecting whether a query parameter is set.

Fixes #45100

Change-Id: I6bb49417e8547e11cc7e8d55c5211d24ee436ec1
GitHub-Last-Rev: 0b27cdab90
GitHub-Pull-Request: golang/go#45835
Reviewed-on: https://go-review.googlesource.com/c/go/+/314850
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
2021-04-30 16:48:56 +00:00
Tobias Klauser
1d2101116f net: don't check nil err twice in interfaceMessages on freebsd
Change-Id: Ie614e49d07b24c5b3dde469561893643bc858d1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/312389
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-21 20:39:43 +00:00
Tobias Klauser
57b0d838ed net: pass MSG_CMSG_CLOEXEC in ReadMsgUnix on dragonfly, netbsd and openbsd
Add support for passing MSG_CMSG_CLOEXEC to the recvmsg syscall on
dragonfly, netbsd and openbsd. MSG_CMSG_CLOEXEC on freebsd is currently
broken, see https://reviews.freebsd.org/D29328.

Change-Id: Ie4c6e3cb550cd0ae32a1c2acca12edf77569e96a
Reviewed-on: https://go-review.googlesource.com/c/go/+/311570
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-20 21:00:46 +00:00
Tobias Klauser
3f8e64878a internal/poll, net: fix comments regarding accept and sysSocket
The implementation of accept was moved from package net to internal/poll
in CL 36799.

Change-Id: I6e5964e0ee22e9c84bc444860cdd497817451fec
Reviewed-on: https://go-review.googlesource.com/c/go/+/311571
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-20 21:00:32 +00:00
Ian Lance Taylor
fe26dfadc3 net: use syscall.fcntl on libc systems
Should fix the AIX builder.

Change-Id: I3498805fb2eee2f0ad50268b5afbbf091c5f6e63
Reviewed-on: https://go-review.googlesource.com/c/go/+/311650
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-20 02:42:23 +00:00
HowJMay
e97d8eb027 net: pass MSG_CMSG_CLOEXEC flag in ReadMsgUnix
As mentioned in #42765, calling "recvmsg" syscall on Linux should come
with "MSG_CMSG_CLOEXEC" flag.

For other systems which not supports "MSG_CMSG_CLOEXEC". ReadMsgUnix()
would check the header. If the header type is "syscall.SCM_RIGHTS",
then ReadMsgUnix() would parse the SocketControlMessage and call each
fd with "syscall.CloseOnExec"

Fixes #42765

Change-Id: I74347db72b465685d7684bf0f32415d285845ebb
GitHub-Last-Rev: ca59e2c9e0
GitHub-Pull-Request: golang/go#42768
Reviewed-on: https://go-review.googlesource.com/c/go/+/272226
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-19 21:27:43 +00:00
Hilko Bengen
fff236e659 net/http/fcgi: eliminate race, keep request id until end of stdin
There was a race condition that could lead to child.serveRequest
removing the request ID before child.handleRequest had read the empty
FCGI_STDIN message that indicates end-of-stream which in turn could
lead to child.serveRequest blocking while trying to consume the
request body.

Now, we remove the request ID from within child.handleRequest after
the end of stdin has been detected, eliminating the race condition.

Since there are no more concurrent modifications/accesses
to child.requests, we remove the accompanying sync.Mutex.

Change-Id: I80c68e65904a988dfa9e3cceec1829496628ff34
GitHub-Last-Rev: b3976111ae
GitHub-Pull-Request: golang/go#42840
Reviewed-on: https://go-review.googlesource.com/c/go/+/273366
Trust: Damien Neil <dneil@google.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-04-16 19:34:33 +00:00
HowJMay
c1e8a9a8c6 net/http/cgi: Remove hard-coded ServeHTTP timeout
Close #43624

Change-Id: Ifaea3d8ec2aeabbd923abf5edd7497172dbf855a
GitHub-Last-Rev: ea3ef953a1
GitHub-Pull-Request: golang/go#43803
Reviewed-on: https://go-review.googlesource.com/c/go/+/284778
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-16 18:46:27 +00:00
ian woolf
acb189ea59 net/http: make ReadRequest return an error when requests have multiple Host headers
Fixes #45513

Change-Id: I59e717a4bbd3e71320deff519e4f9587ee5c8756
Reviewed-on: https://go-review.googlesource.com/c/go/+/308952
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-04-16 16:40:34 +00:00
Peng Gao
2f0e5bf907 net/http: using errors.Is in fs error detection
Compare error by errors.Is to detect wrapped fs errors.

Fixes #44923

Change-Id: Idf32b96a661728278b7006c3b3bcc581b8588259
GitHub-Last-Rev: dba01ddae0
GitHub-Pull-Request: golang/go#45314
Reviewed-on: https://go-review.googlesource.com/c/go/+/306051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-16 16:36:57 +00:00
Joshua Harshman
f08c552dab net/http: add to deadlines only when positive
The existing implementation allows read / write deadlines to exist
in the past. This updates conditionals to only add to the deadline
when the value is positive.

Fixes: #39177
Change-Id: I841c30ba2849a337e7bc98c8aa136c4527c314ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/235437
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Damien Neil <dneil@google.com>
2021-04-16 01:54:27 +00:00
Michael Fraenkel
5631c4b3bf net/http: allow multiple dials in TestTransportMaxConnsPerHost
If there is more than the expected single dial, the channel will block.
Allow at least one connection per client, and do the expected cleanup.

Updates #45570

Change-Id: Iaecd45298a7d7c591b7d7b1be13cea6e4a1e2e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/310213
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-15 16:09:16 +00:00
ian woolf
c3931ab1b7 net/http/httptest: panic on non-3 digit (XXX) status code in Recorder.WriteHeader
This change conforms Recorder with net/http servers, to panic
when a handler writes a non-3 digit XXX status code.

Fixes #45353

Change-Id: Id5ed4af652e8c150ae86bf50402b800d935e2203
Reviewed-on: https://go-review.googlesource.com/c/go/+/308950
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
2021-04-14 21:58:06 +00:00
Josh Rickmar
5c9b6e8e63 net: never probe IPv4 map support on DragonFly BSD, OpenBSD
DragonFly BSD and OpenBSD do not implement mapping IPv4 addresses to
the IPv6 address space, and a runtime check can be avoided.

As the IP stack capabilities probe was only being called from
supportsIPv4map to check for this support, the OS-specific handling
can be added to this function rather than continuing to run the probe.

Change-Id: I5800c197b1be502a6efa79e3edd6356bde8637fb
GitHub-Last-Rev: 7eb67189cd
GitHub-Pull-Request: golang/go#45243
Reviewed-on: https://go-review.googlesource.com/c/go/+/304870
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-12 21:26:59 +00:00
Tobias Klauser
e12abe4bd6 net: fix (*ipStackCapabilities).probe godoc
Change-Id: I2e5db6e7e9a7b3c84449d16b6bc32afe1d0ffee9
Reviewed-on: https://go-review.googlesource.com/c/go/+/308991
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-12 05:11:59 +00:00
6543
189c6946f5 net: reference the correct RFCs and sections for IP.IsPrivate
Properly cite RFC 1918 Section 3 for ipv4,
and RFC 4193 Section 8 for ipv6 comments.

Updates #29146

Change-Id: I8a2df0d7bef50444294bb3301fe09fb09f21ffaf
GitHub-Last-Rev: b0341791c0
GitHub-Pull-Request: golang/go#45500
Reviewed-on: https://go-review.googlesource.com/c/go/+/309249
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-11 15:56:20 +00:00
Naman Gera
52bf14e0e8 all: fix spellings
This follows the spelling choices that the Go project has made for English words.
https://github.com/golang/go/wiki/Spelling

Change-Id: Ie7c586d2cf23020cb492cfff58c0831d2d8d3a78
GitHub-Last-Rev: e16a32cd22
GitHub-Pull-Request: golang/go#45442
Reviewed-on: https://go-review.googlesource.com/c/go/+/308291
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-10 01:46:41 +00:00
ianwoolf
5d5f779db4 net/http: replace os.MkdirTemp with T.TempDir
Updates: #45402
Change-Id: Ia61f422d058bf57fc3688abc25597d6cc1692c51
Reviewed-on: https://go-review.googlesource.com/c/go/+/307653
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-07 06:53:34 +00:00
Ian Lance Taylor
e985245cd5 net: make ErrClosed and ParseError implement net.Error
Fixes #45357

Change-Id: Iafd41fff232a89be4c88d4b1d66bc3c04d888bcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/307030
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-04-05 19:15:53 +00:00
KimMachineGun
a040ebeb98 all: update references to symbols moved from io/ioutil to io
Update references missed in CL 263142.

For #41190

Change-Id: I778760a6a69bd0440fec0848bdef539c9ccb4ee1
GitHub-Last-Rev: dda42b09ff
GitHub-Pull-Request: golang/go#42874
Reviewed-on: https://go-review.googlesource.com/c/go/+/273946
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
2021-04-05 17:51:15 +00:00
Cluas
e6ac2df2b1 net/url: use camelCase names
Change-Id: I191b98b846c9de58b1892e695058c727402b5400
GitHub-Last-Rev: f241ddd96b
GitHub-Pull-Request: golang/go#45291
Reviewed-on: https://go-review.googlesource.com/c/go/+/305770
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-01 05:43:24 +00:00
徐志伟
c93cd86149 net/http: use consistent case in URL in names
Change-Id: Iff5074713e1a4484c04b8628fb2611b6d4e154c7
GitHub-Last-Rev: bb0861bbbe
GitHub-Pull-Request: golang/go#45294
Reviewed-on: https://go-review.googlesource.com/c/go/+/305772
Reviewed-by: Ben Shi <powerman1st@163.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-03-31 03:51:51 +00:00
Baokun Lee
2de1f42857 net: clear completed Buffers to permit earlier collection
Fixes #45163

Change-Id: Ie034145e3818930bb19371d73ec6960cbdc55aa7
Reviewed-on: https://go-review.googlesource.com/c/go/+/303829
Run-TryBot: Baokun Lee <bk@golangcn.org>
Trust: Baokun Lee <bk@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-03-27 03:59:08 +00:00
Damien Neil
5cec8b85e5 net/http/httptest: wait for user ConnState hooks
Ensure that user ConnState callbacks have completed before returning
from (*httptest.Server).Close.

Fixes: #37510
Fixes: #37505
Fixes: #45237
Change-Id: I8fe7baa089fbe4f3836bf6ae9767c7b1270d1331
Reviewed-on: https://go-review.googlesource.com/c/go/+/304829
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-03-25 20:28:20 +00:00