summaryrefslogtreecommitdiff
path: root/src/net
Commit message (Collapse)AuthorAgeFilesLines
* net: use and assert correct res state size at compile time when cgo ↵Mateusz Poliwczak2023-05-161-0/+21
| | | | | | | | | | | | | | | available on darwin Change-Id: I961bb18604dd1568ea21431545f43aa6a417b3d9 GitHub-Last-Rev: 735f3364a4f2182f3e3e1b84f39a042e86987967 GitHub-Pull-Request: golang/go#60046 Reviewed-on: https://go-review.googlesource.com/c/go/+/493415 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
* Revert "net/http: do not force the Content-Length header if nilled"Austin Clements2023-05-152-35/+1
| | | | | | | | | | | | | | | This reverts CL 469095. The newly added TestDisableContentLength is failing on all longtest builders. Change-Id: Id307df61c7bf80691d9c276e8d200eebf6d4a59c Reviewed-on: https://go-review.googlesource.com/c/go/+/495017 Auto-Submit: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net/http: handle WriteHeader(101) as a non-informational headerDamien Neil2023-05-152-2/+74
| | | | | | | | | | | | | | | | | | | | | | Prior to Go 1.19 adding support for sending 1xx informational headers with ResponseWriter.WriteHeader, WriteHeader(101) would send a 101 status and disable further writes to the response. This behavior was not documented, but is intentional: Writing to the response body explicitly checks to see if a 101 status has been sent before writing. Restore the pre-1.19 behavior when writing a 101 Switching Protocols header: The header is sent, no subsequent headers are sent, and subsequent writes to the response body fail. For #59564 Change-Id: I72c116f88405b1ef5067b510f8c7cff0b36951ee Reviewed-on: https://go-review.googlesource.com/c/go/+/485775 Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net/http: do not force the Content-Length header if nilledLaurent Senta2023-05-152-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | According to the ResponseWriter documentation: To suppress automatic response headers (such as "Date"), set their value to nil. In some cases, this documentation is incorrect: chunkWriter writes a Content-Length header even if the value was set to nil. Meaning there is no way to suppress this header. This patch replaces the empty string comparison with a call to `header.has` which takes into account nil values as expected. This is similar to the way we handle the "Date" header. Change-Id: Ie10d54ab0bb7d41270bc944ff867e035fe2bd0c5 GitHub-Last-Rev: e0616dd46388a724df7c6ea821b3808ed1663cab GitHub-Pull-Request: golang/go#58578 Reviewed-on: https://go-review.googlesource.com/c/go/+/469095 Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Run-TryBot: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Damien Neil <dneil@google.com>
* net: add tests for forceGoDNS and forceCgoDNSMateusz Poliwczak2023-05-121-0/+21
| | | | | | | | | | | | | | | | There was a bug in forceCgoDNS (CL 479416), it was fixed by CL 487196, so add a test case for it. Change-Id: I2010374451ef236dc2898d9e9ea006eb8b40d02e GitHub-Last-Rev: 34a84fad33404c66c3ee20cb63803214c42e991d GitHub-Pull-Request: golang/go#59922 Reviewed-on: https://go-review.googlesource.com/c/go/+/491255 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* net: don't treat unknown sources as dns when there is a dns sourceMateusz Poliwczak2023-05-112-10/+44
| | | | | | | | | | | | | Change-Id: I3a6c3a804604b1e74a1ea6b66ab2c932a0ac973a GitHub-Last-Rev: ea5403549a51a29a2799674d74425b480253d2f1 GitHub-Pull-Request: golang/go#60025 Reviewed-on: https://go-review.googlesource.com/c/go/+/493236 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net: clear /etc/hosts cache on fs.ErrNotExist and fs.ErrPermission errorsMateusz Poliwczak2023-05-111-36/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was also the cause of my issues in CL 455275 Before: root@arch:~/aa# $(time sleep 5 && mv /etc/hosts /tmp/hosts) & [1] 2214 root@arch:~/aa# go run main.go [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> (....) After: root@arch:~/aa# $(time sleep 5 && mv /etc/hosts /tmp/hosts) & [1] 2284 root@arch:~/aa# go run main.go [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> [232.223.232.123] <nil> [] lookup sth on 127.0.0.53:53: server misbehaving [] lookup sth on 127.0.0.53:53: server misbehaving Change-Id: I3090fd8f3105db8c2d7c3bf5afe7b18ebca61cda GitHub-Last-Rev: cb0dac6448bbc337cd015ad4b4b3d1da3f14a561 GitHub-Pull-Request: golang/go#59963 Reviewed-on: https://go-review.googlesource.com/c/go/+/492555 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
* net: return fallbackOrder immediately for some GOOSMateusz Poliwczak2023-05-111-0/+6
| | | | | | | | | | | | | | | | We don't need to check resolv.conf, nsswitch.conf on these systems. Seems like this was the behaviour before CL 487196. Change-Id: I34ef3510891c572772a222fbbe47693aa6c7cf38 GitHub-Last-Rev: 3aace0e6615b79bbf379e05ca3a353e194dc7c0b GitHub-Pull-Request: golang/go#59946 Reviewed-on: https://go-review.googlesource.com/c/go/+/491995 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* net: force cgo for myhostname and mdns nss modules for LookupAddr on unixMateusz Poliwczak2023-05-113-49/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently there is a small bug in the LookupAddr for unix systems that causes the use of go resolver instead of the cgo one. Example for nss myhostname: func main() { fmt.Println(net.LookupAddr(os.Args[1])) } root@arch:~# cat /etc/nsswitch.conf | grep host hosts: myhostname dns root@arch:~# GODEBUG=netdns=+3 go run main.go 192.168.1.200 go package net: confVal.netCgo = false netGo = false go package net: dynamic selection of DNS resolver go package net: hostLookupOrder() = dns [] lookup 200.1.168.192.in-addr.arpa. on 8.8.8.8:53: no such host root@arch:~# GODEBUG=netdns=go+3 go run main.go 192.168.1.200 go package net: confVal.netCgo = false netGo = true go package net: GODEBUG setting forcing use of Go's resolver go package net: hostLookupOrder() = dns [] lookup 200.1.168.192.in-addr.arpa. on 8.8.8.8:53: no such host root@arch:~# GODEBUG=netdns=cgo+3 go run main.go 192.168.1.200 go package net: confVal.netCgo = true netGo = false go package net: using cgo DNS resolver go package net: hostLookupOrder() = cgo [arch] <nil> The problem come from that we are only checking for hostnames that the myhostname can resolve, but not for the addrs that it can also. man nss-myhostname: Please keep in mind that nss-myhostname (and nss-resolve) also resolve in the other direction — from locally attached IP addresses to hostnames. Change-Id: Ic18a9f99a2214b2938463e9a95f7f3ca5db1c01b GitHub-Last-Rev: ade40fd3e3057de418b9b6a79f79fb9a53fb6c09 GitHub-Pull-Request: golang/go#59921 Reviewed-on: https://go-review.googlesource.com/c/go/+/491235 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
* net: use the lookupOrder for go resolver LookupAddrMateusz Poliwczak2023-05-114-13/+26
| | | | | | | | | | | | | | | To mach the cgo version behaviour and the LookupHost (go resolver). Change-Id: I7dc3424d508a62e67f20c7810743399c35a9b60c GitHub-Last-Rev: 29924c13a6c0598bf58b7fc3fae74b10bab0f0ee GitHub-Pull-Request: golang/go#60024 Reviewed-on: https://go-review.googlesource.com/c/go/+/493235 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* net/http: let ErrNotSupported match errors.ErrUnsupportedIan Lance Taylor2023-05-102-0/+12
| | | | | | | | | | | | For #41198 Change-Id: Ibb030e94618a1f594cfd98ddea214ad7a88d2e73 Reviewed-on: https://go-review.googlesource.com/c/go/+/494122 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* all: fix a lot of commentscui fliter2023-05-103-7/+7
| | | | | | | | | | | | | Fix comments, including duplicate is, wrong phrases and articles, misspellings, etc. Change-Id: I8bfea53b9b275e649757cc4bee6a8a026ed9c7a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/493035 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
* net: correct Dialer.ControlContext documentationJabar Asadi2023-05-091-3/+3
| | | | | | | | | | | | Change-Id: I4ec5883fc8713e0f711bb6beff45f426dae8f9f4 GitHub-Last-Rev: 9ea0c1505c2f3974e5d224299db5f888a4cf7618 GitHub-Pull-Request: golang/go#59819 Reviewed-on: https://go-review.googlesource.com/c/go/+/488315 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
* net/http: regenerate h2_bundle.goBryan C. Mills2023-05-091-6/+24
| | | | | | | | | | | | | The x/net version was updated in CL 493596; cmd/internal/moddeps catches the skew, but only runs on the -longtest builders (because it requires network access for the bundle tool and x/net dependency). Change-Id: I48891d51aab23b2ca6f4484215438c60bd8c8c21 Reviewed-on: https://go-review.googlesource.com/c/go/+/493875 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
* net: net remove completed return from cgo lookup functionsMateusz Poliwczak2023-05-045-98/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | After CL 487196 there is no need anymore to return completed == false from the cgo lookup functions and then fallback to to go resolver. (Before CL 487196 this change would cause the (only?) tests to fail) Now the cgoAvailable constant guards that correctly. This change will cause a panic when the cgo resolver is being used without the cgo support, so it will be easier to detect bug while changing the code in the net package. I am leaving the completed return from cgoLookupCNAME, because it is super broken now. Change-Id: I2661b9a3725de2b1a229847c12adf64b3f62b136 GitHub-Last-Rev: 2a6501a53e1b2c5195c3869d528a40e7f93d6225 GitHub-Pull-Request: golang/go#59925 Reviewed-on: https://go-review.googlesource.com/c/go/+/491275 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* all: add String for fs.{FileInfo,DirEntry} implementationsIan Lance Taylor2023-05-041-0/+4
| | | | | | | | | | | | | | | | | The new String methods use the new FormatFileInfo and FormatDirEntry functions. Fixes #54451 Change-Id: I414cdfc212ec3c316fb2734756d2117842a23631 Reviewed-on: https://go-review.googlesource.com/c/go/+/491175 Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
* net/http: avoid leaking the writing goroutineMichael Fraenkel2023-05-021-0/+6
| | | | | | | | | | | | | | | | | The test will wait for all goroutines. A race can occur if the writing goroutine uses the Log after the test exits. For #58264 For #59883 For #59884 Change-Id: I9b8ec7c9d024ff74b922b69efa438be5a4fa3483 Reviewed-on: https://go-review.googlesource.com/c/go/+/490255 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
* net: don't recheck goosPrefersCgo in hostLookupOrderIan Lance Taylor2023-05-022-22/+3
| | | | | | | | | | | | We only did it for testing. Remove the single test that required it. Change-Id: Ib6c3a2debfd3f48e95af37f23fdfde847ff87a41 Reviewed-on: https://go-review.googlesource.com/c/go/+/490395 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
* net: re check conf.goos even if it equals runtime.GOOSIan Lance Taylor2023-04-281-1/+1
| | | | | | | | | | | | | | | | This field is only for testing purposes, where we can't assume that the conf value was initialized as expected for that GOOS. This fixes the net tests on android. Change-Id: I8432587f219a05adbb4d234a813467f876a764b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/489975 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* net: rewrite and simplify resolver configurationIan Lance Taylor2023-04-2718-188/+379
| | | | | | | | | | | | | | | | | The resulting code behaves mostly the same. There are some minor differences in error cases when the cgo resolver is not available: instead of just falling back we keep trying to work out the right nsswitch.conf order. Change-Id: I17fadc940528fa2397043ac8f8ed7da3bd7a95c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/487196 Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
* net/http/cgi: propagate LD_LIBRARY_PATH on AndroidBryan C. Mills2023-04-261-1/+1
| | | | | | | | | | | Android is functionally a variant on linux, and should be treated as such. Change-Id: I08056f00bf98c1935c8cc3c859a6c72fe1a48efa Reviewed-on: https://go-review.googlesource.com/c/go/+/489395 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
* std: fix various nilness findingsAlan Donovan2023-04-201-3/+4
| | | | | | | | | | | | | | | Found by running $ go run golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest std No actual bugs--other than one panic(nil)--but a few places where error nilness was unclear. Change-Id: Ia916ba30f46f29c1bcf928cc62280169b922463a Reviewed-on: https://go-review.googlesource.com/c/go/+/486675 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
* net: remove unused _C_FreeCStringTobias Klauser2023-04-192-3/+1
| | | | | | | | | | | | It's unused since CL 486015. Change-Id: Ic9397f5f84940a09f05499da2774b952fe6d1365 Reviewed-on: https://go-review.googlesource.com/c/go/+/486475 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
* net: check for NUL bytes in strings passed to C functionsIan Lance Taylor2023-04-193-15/+14
| | | | | | | | | | | | | Use syscall.BytePtrFromString and syscall.ByteSliceFromString. Change-Id: I9409ecd93aaca82390bf3f34be56ec354148a241 Reviewed-on: https://go-review.googlesource.com/c/go/+/486015 Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
* syscall: add a sync.Pool for a NetlinkRIB scratch bufferBrad Fitzpatrick2023-04-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The syscall.NetlinkRIB signature means it necessarily allocates but this changes makes it allocate a bit less. For example, in the net package: name old time/op new time/op delta Interfaces-8 59.1µs ± 3% 57.3µs ± 2% -3.02% (p=0.000 n=10+10) InterfaceByIndex-8 53.1µs ± 5% 50.6µs ± 2% -4.81% (p=0.000 n=10+10) InterfaceByName-8 59.3µs ± 2% 57.4µs ± 1% -3.29% (p=0.000 n=10+10) InterfaceAddrs-8 105µs ± 1% 101µs ± 1% -4.22% (p=0.000 n=10+9) InterfacesAndAddrs-8 38.2µs ± 3% 36.3µs ± 2% -4.98% (p=0.000 n=10+10) InterfacesAndMulticastAddrs-8 152µs ± 2% 154µs ± 6% ~ (p=0.105 n=10+10) name old alloc/op new alloc/op delta Interfaces-8 22.8kB ± 0% 18.7kB ± 0% -17.90% (p=0.000 n=10+9) InterfaceByIndex-8 16.2kB ± 0% 12.1kB ± 0% -25.22% (p=0.000 n=10+10) InterfaceByName-8 22.8kB ± 0% 18.8kB ± 0% -17.85% (p=0.000 n=10+10) InterfaceAddrs-8 36.6kB ± 0% 28.5kB ± 0% -22.28% (p=0.000 n=10+10) InterfacesAndAddrs-8 9.60kB ± 0% 5.51kB ± 0% -42.59% (p=0.000 n=10+7) InterfacesAndMulticastAddrs-8 141kB ± 0% 141kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta Interfaces-8 53.0 ± 0% 52.0 ± 0% -1.89% (p=0.000 n=10+10) InterfaceByIndex-8 28.0 ± 0% 27.0 ± 0% -3.57% (p=0.000 n=10+10) InterfaceByName-8 54.0 ± 0% 53.0 ± 0% -1.85% (p=0.000 n=10+10) InterfaceAddrs-8 155 ± 0% 153 ± 0% -1.29% (p=0.000 n=10+10) InterfacesAndAddrs-8 38.0 ± 0% 37.0 ± 0% -2.63% (p=0.000 n=10+10) InterfacesAndMulticastAddrs-8 77.0 ± 0% 77.0 ± 0% ~ (all equal) Signed-off-by: Brad Fitzpatrick <bradfitz@golang.org> Change-Id: Ic3278b2c000af78d7ed816645463c3b7ff0c90ca Reviewed-on: https://go-review.googlesource.com/c/go/+/485455 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
* net: mptcp: add TCPConn's MultipathTCP checkerMatthieu Baerts2023-04-184-3/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new TCPConn method returns whether the connection is using MPTCP or if a fallback to TCP has been done, e.g. because the other peer doesn't support MPTCP. When working on the new E2E test linked to MPTCP (#56539), it looks like the user might need to know such info to be able to do some special actions (report, stop, etc.). This also improves the test to make sure MPTCP has been used as expected. Regarding the implementation, from kernel version 5.16, it is possible to use: getsockopt(..., SOL_MPTCP, MPTCP_INFO, ...) and check if EOPNOTSUPP (IPv4) or ENOPROTOOPT (IPv6) is returned. If it is, it means a fallback to TCP has been done. See this link for more details: https://github.com/multipath-tcp/mptcp_net-next/issues/294 Before v5.16, there is no other simple way, from the userspace, to check if the created socket did a fallback to TCP. Netlink requests could be done to try to find more details about a specific socket but that seems quite a heavy machinery. Instead, only the protocol is checked on older kernels. The E2E test has been modified to check that the MPTCP connection didn't do any fallback to TCP, explicitely validating the two methods (SO_PROTOCOL and MPTCP_INFO) if it is supported by the host. This work has been co-developed by Gregory Detal <gregory.detal@tessares.net> and Benjamin Hesmans <benjamin.hesmans@tessares.net>. Fixes #59166 Change-Id: I5a313207146f71c66c349aa8588a2525179dd8b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/471140 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
* net/http: avoid leaking writer goroutines in testsBryan C. Mills2023-04-122-3/+56
| | | | | | | | | | | | | | | | | | | | | | | | | In TestTransportPrefersResponseOverWriteError and TestMaxBytesHandler, the server may respond to an incoming request without ever reading the request body. The client's Do method will return as soon as the server's response headers are read, but the Transport will remain active until it notices that the server has closed the connection, which may be arbitrarily later. When the server has closed the connection, it will call the Close method on the request body (if it has such a method). So we can use that method to find out when the Transport is close enough to done for the test to complete without interfering too much with other tests. For #57612. For #59526. Change-Id: Iddc7a3b7b09429113ad76ccc1c090ebc9e1835a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/483895 Run-TryBot: Bryan Mills <bcmills@google.com> Commit-Queue: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
* net/http: only report the first leak of each test runBryan C. Mills2023-04-122-3/+20
| | | | | | | | | | | | | | | | | | | | | | | We don't have a way to terminate the leaked goroutines, and we can't wait forever for them to exit (or else we would risk timing out the test and losing the log line describing what exactly leaked). So we have reason to believe that they will remain leaked while we run the next test, and we don't want the goroutines from the first leak to generate a spurious error when the second test completes. This also removes a racy Parallel call I added in CL 476036, which was flagged by the race detector in the duplicate-suppression check. (I hadn't considered the potential interaction with the leak checker.) For #59526. Updates #56421. Change-Id: Ib1f759f102fb41ece114401680cd728343e58545 Reviewed-on: https://go-review.googlesource.com/c/go/+/483896 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
* all: update vendored golang.org/x/netTobias Klauser2023-04-112-13/+13
| | | | | | | | | | | | | | | | | Pull in CL 483375. This also updates golang.org/x/sys to v0.7.0 and thus we also need to update it to that version in cmd to keep TestDependencyVersionsConsistent happy. Fixes #22927 Change-Id: Ice14cd66a5c2a621b373c3d29455c75494436045 Reviewed-on: https://go-review.googlesource.com/c/go/+/483595 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net: add wasip1 supportJohan Brandhorst-Satzkorn2023-04-1155-57/+58
| | | | | | | | | | | | | | | | For #58141 Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: I09a7cf33e43cb0e17ab3793c22cbad90b9e83b62 Reviewed-on: https://go-review.googlesource.com/c/go/+/479626 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net/http, net/internal, net/smtp: add wasip1Johan Brandhorst-Satzkorn2023-04-118-10/+8
| | | | | | | | | | | | | | | | For #58141 Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: Ib49b7ccabe18de544455f7d09c7d715d6564a73d Reviewed-on: https://go-review.googlesource.com/c/go/+/479625 Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net: allow TestDialListenerAddr without an external networkBryan C. Mills2023-04-111-2/+0
| | | | | | | | | | | | | | As of CL 482163, this test now works when only a loopback network is available. Updates #59497. Change-Id: I32be4b74bbc663eb109763ea19d79f22c63f50ae Reviewed-on: https://go-review.googlesource.com/c/go/+/483696 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
* net: avoid opening an external port in TestDialListenerAddrBryan C. Mills2023-04-101-4/+36
| | | | | | | | | | | | | | | The behavior in #18806 can be tested with a localhost-only port, provided that we're willing to assume what format the listener would report for an external dual-stack port. Fixes #59497. Change-Id: I171fb03eb46aee8e85480e04626a23f4f3b923e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/482163 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
* net: re-enable unixpacket tests on netbsd/386Tobias Klauser2023-04-101-5/+0
| | | | | | | | | | | | | | | The tests seem to work fine on netbsd/386 (NetBSD 9.3). This reverts CL 80756. Updates #22927 Change-Id: I2235d69129aa81b43513a171834d058f47cd9933 Reviewed-on: https://go-review.googlesource.com/c/go/+/483395 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
* net/http: expose "http: server gave HTTP response to HTTPS client" errorAkihiro Suda2023-04-071-1/+4
| | | | | | | | | | | | | | | | Expose "http: server gave HTTP response to HTTPS client" error as `ErrSchemeMismatch`, so that it can be compared with `errors.Is` . Fixes #44855 Change-Id: If96e0d000fdef641fea407310faf9e1c4f7ad0f0 GitHub-Last-Rev: 22879fc88367d77817d7d96c9164f22e55f3a192 GitHub-Pull-Request: golang/go#50939 Reviewed-on: https://go-review.googlesource.com/c/go/+/382117 Run-TryBot: Damien Neil <dneil@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
* net/http: wait forever for write results in testsDamien Neil2023-04-074-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After performing a round trip on a connection, the connection is usually returned to the idle connection pool. If the write of the request did not complete successfully, the connection is not returned. It is possible for the response to be read before the write goroutine has finished signalling that its write has completed. To allow for this, the check to see if the write completed successfully waits for 50ms for the write goroutine to report the result of the write. See comments in persistConn.wroteRequest for more details. On a slow builder, it is possible for the write goroutine to take longer than 50ms to report the status of its write, leading to test flakiness when successive requests unexpectedly use different connections. Set the timeout for waiting for the writer to an effectively infinite duration in tests. Fixes #51147 Fixes #56275 Fixes #56419 Fixes #56577 Fixes #57375 Fixes #57417 Fixes #57476 Fixes #57604 Fixes #57605 Change-Id: I5e92ffd66b676f3f976d8832c0910f27456a6991 Reviewed-on: https://go-review.googlesource.com/c/go/+/483116 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
* net/http: fix a race in TestResponseControllerSetPastReadDeadlineBryan C. Mills2023-04-071-2/+6
| | | | | | | | | | | | | | | | | | | If the Write goroutine is delayed for long enough after its first Write, the handler may have closed both the readc and donec channels by the time it selects over them, and the donec case may be randomly chosen. Handle that case by explicitly checking readc as well. This fixes a race accidentally introduced in CL 482935 and observed in https://build.golang.org/log/fa684750994d1fda409722f144b90c65b4c52cf9. For #59447. Change-Id: I5c87a599910cf8c1d037e5bbce68bf35afd55d61 Reviewed-on: https://go-review.googlesource.com/c/go/+/483036 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
* net/http: improve failure mode for TestResponseControllerSetPastReadDeadlineDamien Neil2023-04-061-2/+9
| | | | | | | | | | | | | | | | | | | A test flake in #59447 seems to indicate that this test got stuck waiting for the test handler to close the readc channel. If the handler returns early due to an unexpected error, it might fail to close this channel. Add a second channel to act as a signal that the handler has given up and the test should stop. This won't fix whatever happened in the flake, but might help us debug it if it happens again. For #59447 Change-Id: I05d84c6176aa938887d93126a6f3bb4dc941c90d Reviewed-on: https://go-review.googlesource.com/c/go/+/482935 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com>
* net/http: add tests covering non-GET methods for file servingDamien Neil2023-04-061-5/+78
| | | | | | | | | | | | | | | | ServeFile and FileServer will respond to methods such as DELETE by serving the file contents. This is surprising, but we don't want to change it without some consideration. Add tests covering the current behavior. For #59470 Change-Id: Ib6a2594c5b2b7f380149fc1628f7204b308161e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/482876 Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Tatiana Bradley <tatianabradley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* Revert "net/http: FileServer method check + minimal OPTIONS implementation"Damien Neil2023-04-062-56/+5
| | | | | | | | | | | | | | | This reverts https://go.dev/cl/413554 Reason for revert: Backwards-incompatible change in behavior. For #53501 For #59375 Change-Id: Ic3f63b378f9c819599b32e5e6e410f6163849317 Reviewed-on: https://go-review.googlesource.com/c/go/+/482635 Reviewed-by: Tatiana Bradley <tatianabradley@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net/http: drop client address comparison in ↵Bryan C. Mills2023-04-041-7/+4
| | | | | | | | | | | | | | | | | | TestTransportRemovesDeadIdleConnections Since the first client connection is explicitly closed before making the second request, we cannot in general assume that the second request uses a different port (it is equally valid to open the new connection on the same port as the old one that was closed). Fixes #59438. Change-Id: I52d5fe493bd8b1b49270d3996d2019d38d375ce9 Reviewed-on: https://go-review.googlesource.com/c/go/+/482175 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* mime/multipart: limit parsed mime message sizesDamien Neil2023-04-041-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parsed forms of MIME headers and multipart forms can consume substantially more memory than the size of the input data. A malicious input containing a very large number of headers or form parts can cause excessively large memory allocations. Set limits on the size of MIME data: Reader.NextPart and Reader.NextRawPart limit the the number of headers in a part to 10000. Reader.ReadForm limits the total number of headers in all FileHeaders to 10000. Both of these limits may be set with with GODEBUG=multipartmaxheaders=<values>. Reader.ReadForm limits the number of parts in a form to 1000. This limit may be set with GODEBUG=multipartmaxparts=<value>. Thanks for Jakob Ackermann (@das7pad) for reporting this issue. For CVE-2023-24536 For #59153 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802455 Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> Change-Id: I08dd297bd75724aade4b0bd6a7d19aeca5bbf99f Reviewed-on: https://go-review.googlesource.com/c/go/+/482077 Run-TryBot: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net/textproto, mime/multipart: improve accounting of non-file dataDamien Neil2023-04-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | For requests containing large numbers of small parts, memory consumption of a parsed form could be about 250% over the estimated size. When considering the size of parsed forms, account for the size of FileHeader structs and increase the estimate of memory consumed by map entries. Thanks to Jakob Ackermann (@das7pad) for reporting this issue. For CVE-2023-24536 For #59153 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802454 Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> Change-Id: I9620758495ed77c09ca6dc5db4b723c29f3baad8 Reviewed-on: https://go-review.googlesource.com/c/go/+/482076 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net/textproto: avoid overpredicting the number of MIME header keysDamien Neil2023-04-042-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A parsed MIME header is a map[string][]string. In the common case, a header contains many one-element []string slices. To avoid allocating a separate slice for each key, ReadMIMEHeader looks ahead in the input to predict the number of keys that will be parsed, and allocates a single []string of that length. The individual slices are then allocated out of the larger one. The prediction of the number of header keys was done by counting newlines in the input buffer, which does not take into account header continuation lines (where a header key/value spans multiple lines) or the end of the header block and the start of the body. This could lead to a substantial amount of overallocation, for example when the body consists of nothing but a large block of newlines. Fix header key count prediction to take into account the end of the headers (indicated by a blank line) and continuation lines (starting with whitespace). Thanks to Jakob Ackermann (@das7pad) for reporting this issue. For #58975 Fixes CVE-2023-24534 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802452 Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> Change-Id: Iacc1c2b5ea6509529845a972414199f988ede1e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/481994 Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
* net: treat EAI_NODATA as errNoSuchHostMateusz Poliwczak2023-04-044-1/+73
| | | | | | | | | | | | | | | | | | | | man getaddrinfo: EAI_NODATA The specified network host exists, but does not have any network addresses defined. In the go resolver we treat this kind of error as nosuchhost. Change-Id: I69fab6f8da8e3a86907e65104bca9f055968633a GitHub-Last-Rev: b4891e2addaeccecb242d0485daa168bb55cf54e GitHub-Pull-Request: golang/go#57507 Reviewed-on: https://go-review.googlesource.com/c/go/+/459955 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* all: fix misuses of "a" vs "an"cui fliter2023-04-042-3/+3
| | | | | | | | | | | | | | Fixes the misuse of "a" vs "an", according to English grammatical expectations and using https://www.a-or-an.com/ Change-Id: I53ac724070e3ff3d33c304483fe72c023c7cda47 Reviewed-on: https://go-review.googlesource.com/c/go/+/480536 Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
* net: unskip TestConcurrentPreferGoResolversDial on Windowsqmuntal2023-03-311-3/+3
| | | | | | | | | | | Windows resolver uses the Dial function since CL 409234. Change-Id: Id631a84d2b85fc4f8897e413a0a454cf54c00de4 Reviewed-on: https://go-review.googlesource.com/c/go/+/480418 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
* all: replace fmt.Sprintf("%d") with strconv.ItoaPhilippe Antoine2023-03-311-1/+1
| | | | | | | | | | | | | | | | | | | This was found by running `git grep 'fmt.Sprintf("%d",' | grep -v test | grep -v vendor` And this was automatically fixed with gotiti https://github.com/catenacyber/gotiti and using unconvert https://github.com/mdempsky/unconvert to check if there was (tool which fixed another useless cast) Change-Id: I023926bc4aa8d51de45f712ac739a0a80145c28c GitHub-Last-Rev: 1063e32e5b69b6f9bb17673887b8c4ebe5be8fe4 GitHub-Pull-Request: golang/go#59144 Reviewed-on: https://go-review.googlesource.com/c/go/+/477675 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* net: mptcp: add end-to-end testMatthieu Baerts2023-03-301-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a simple test validating MPTCP Sock for Linux implementation: - A Listener is created with MPTCP support, accepting new connections in a new thread. - A Dialer with MPTCP support connects to this new Listener - On both sides, MPTCP should be used. Note that at this point, we cannot check if a fallback to TCP has been done nor if the correct protocol is being used. Technically, a localServer from mockserver_test.go is used, similar to TestIPv6LinkLocalUnicastTCP from tcpsock_test.go. Here with MPTCP, the Listen step is done manually to force using MPTCP and a post step is done to verify extra status after the Accept. More checks are going to be done in the future. Please note that the test is skipped if the kernel doesn't allow the creation of an MPTCP socket at all when starting the test. The test can be executed with this command: $ ../bin/go test -v net -run "^TestMultiPathTCP$" The "-race" option has also been checked. This work has been co-developped by Benjamin Hesmans <benjamin.hesmans@tessares.net> and Gregory Detal <gregory.detal@tessares.net>. Fixes #56539 Change-Id: I4b6b39e9175a20f98497b5ea56934e242da06194 Reviewed-on: https://go-review.googlesource.com/c/go/+/471141 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
* net: mptcp: fallback to TCP in case of any errorMatthieu Baerts2023-03-301-8/+22
| | | | | | | | | | | | | | | | | | | | | | | | Specific MPTCP errors could happen but only one is detectable: if ENOPROTOOPT errno is returned, it likely means MPTCP has been disable via this sysctl knob: net.mptcp.enabled. But because MPTCP could be blocked by the administrator using different techniques (SELinux, etc.) making the socket creation returning other errors, it looks better to always retry to create a "plain" TCP socket when any errors are returned. This work has been co-developed by Gregory Detal <gregory.detal@tessares.net>. Updates #56539 Change-Id: I94fb8448dae351e1d3135b4f182570979c6b36d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/471138 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>