aboutsummaryrefslogtreecommitdiff
path: root/src/net
AgeCommit message (Collapse)Author
2021-08-20net/http: fix typo in header.goHuanCheng
Change-Id: Ia6df881badf9a704c7f56967404d37e230b88a09 Reviewed-on: https://go-review.googlesource.com/c/go/+/343969 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Damien Neil <dneil@google.com>
2021-08-17all: fix typosYasuhiro Matsumoto
Change-Id: I83180c472db8795803c1b9be3a33f35959e4dcc2 Reviewed-on: https://go-review.googlesource.com/c/go/+/336889 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2021-08-16net: reduce allocation size in ReadFromUDPJosh Bleecher Snyder
Switch to concrete types. Bring your own object to fill in. Allocate just enough for the IP byte slice. The allocation is now just 4 bytes for IPv4, which puts it in the tiny allocator, which is much faster. name old time/op new time/op delta WriteToReadFromUDP-8 13.7µs ± 1% 13.4µs ± 2% -2.49% (p=0.000 n=10+10) name old alloc/op new alloc/op delta WriteToReadFromUDP-8 32.0B ± 0% 4.0B ± 0% -87.50% (p=0.000 n=10+10) name old allocs/op new allocs/op delta WriteToReadFromUDP-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) Windows is temporarily stubbed out. Updates #43451 Change-Id: Ief506f891b401d28715d22dce6ebda037941924e Reviewed-on: https://go-review.googlesource.com/c/go/+/331490 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Damien Neil <dneil@google.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2021-08-16net: remove allocation from UDPConn.WriteToJosh Bleecher Snyder
Duplicate some code to avoid an interface. name old time/op new time/op delta WriteToReadFromUDP-8 6.38µs ±20% 5.59µs ±10% -12.38% (p=0.001 n=10+9) name old alloc/op new alloc/op delta WriteToReadFromUDP-8 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=10+10) name old allocs/op new allocs/op delta WriteToReadFromUDP-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10) Windows is temporarily stubbed out. Updates #43451 Change-Id: Ied15ff92268c652cf445836e0446025eaeb60cc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/331489 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Damien Neil <dneil@google.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2021-08-16net: avoid memory copy calling absDomainNameAndy Pan
Change-Id: I8ea9bec8bc33e29b8c265fbca40871bc23667144 Reviewed-on: https://go-review.googlesource.com/c/go/+/330470 Reviewed-by: Damien Neil <dneil@google.com> Trust: Damien Neil <dneil@google.com> Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16net/http: drop headers with invalid keys in Header.WriteDamien Neil
Don't let handlers inject unexpected headers by setting keys like: w.Header().Set("Evil: x\r\nSmuggle", y) Fixes #47711. Change-Id: I459ce1c79bc273a84230a0f5b665f81c46dbc672 Reviewed-on: https://go-review.googlesource.com/c/go/+/342530 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16internal/syscall/unix: change Ioctl arg type to unsafe.Pointer on AIXMatt Layher
Without this change, this code is technically in violation of the unsafe.Pointer rules since the conversion from unsafe.Pointer to uintptr has to happen when calling into the syscall6 assembly implementation. Change-Id: I4821f5bf9788c8fa2efeb041f811ed092e07ae74 Reviewed-on: https://go-review.googlesource.com/c/go/+/340949 Trust: Matt Layher <mdlayher@gmail.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-13net: update IP.String doc to reflect RFC 5952 conformancehitzhangjie
Fixes #44485 Change-Id: I1b1bf14245ef738342ec881ac4c99adbfc9c5b7d GitHub-Last-Rev: ae0242c6d61fc0e80c58113a70db74829f6aa12c GitHub-Pull-Request: golang/go#47394 Reviewed-on: https://go-review.googlesource.com/c/go/+/337409 Trust: Dmitri Shuralyov <dmitshur@golang.org> Trust: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2021-08-04net/http: speed up and deflake TestCancelRequestWhenSharingConnectionDamien Neil
This test made many requests over the same connection for 10 seconds, trusting that this will exercise the request cancelation race from #41600. Change the test to exhibit the specific race in a targeted fashion with only two requests. Updates #41600. Updates #47016. Change-Id: If99c9b9331ff645f6bb67fe9fb79b8aab8784710 Reviewed-on: https://go-review.googlesource.com/c/go/+/339594 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
2021-07-30net/http/httputil: close incoming ReverseProxy request bodyDamien Neil
Reading from an incoming request body after the request handler aborts with a panic can cause a panic, becuse http.Server does not (contrary to its documentation) close the request body in this case. Always close the incoming request body in ReverseProxy.ServeHTTP to ensure that any in-flight outgoing requests using the body do not read from it. Updates #46866 Fixes CVE-2021-36221 Change-Id: I310df269200ad8732c5d9f1a2b00de68725831df Reviewed-on: https://go-review.googlesource.com/c/go/+/333191 Trust: Damien Neil <dneil@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-07-16net/http: correct capitalization in cancelTimeBody commentshota3506
Change-Id: I7acda22c01c5350ebf5ddabb1c12af96d368de5d GitHub-Last-Rev: 3e5c022f8764d4abf91c964ceb4fc0e01ebd1352 GitHub-Pull-Request: golang/go#47160 Reviewed-on: https://go-review.googlesource.com/c/go/+/334229 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2021-07-08net: filter bad names from Lookup functions instead of hard failingRoland Shoemaker
Instead of hard failing on a single bad record, filter the bad records and return anything valid. This only applies to the methods which can return multiple records, LookupMX, LookupNS, LookupSRV, and LookupAddr. When bad results are filtered out, also return an error, indicating that this filtering has happened. Updates #46241 Fixes #46979 Change-Id: I6493e0002beaf89f5a9795333a93605abd30d171 Reviewed-on: https://go-review.googlesource.com/c/go/+/332549 Trust: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-07-02net/http: mention socks5 support in proxySean Liao
Change-Id: I55b6d5c77221569eeafea625379affd476a65772 Reviewed-on: https://go-review.googlesource.com/c/go/+/326011 Reviewed-by: Damien Neil <dneil@google.com> Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-01net: don't reject null mx recordsRoland Shoemaker
Bypass hostname validity checking when a null mx record is returned as, defined in RFC 7505. Updates #46979 Change-Id: Ibe683bd6b47333a8ff30909fb2680ec8e10696ef Reviewed-on: https://go-review.googlesource.com/c/go/+/332094 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-06-29net: fix failure of TestCVE202133195Xiangdong Ji
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-24net: remove hard-coded timeout in dialClosedPort test helperBryan C. Mills
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-24net: use absDomainName in the Windows lookupPTR test helperBryan C. Mills
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-15net/http: improve some server docsFilippo Valsorda
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-10net/http: remove test-only private key from production binariesDamien Neil
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-09net/http: add AllowQuerySemicolonsFilippo Valsorda
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-09net/url: reject query values with semicolonsKatie Hockman
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-08net: reject leading zeros in IP address parsersRoland Shoemaker
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-04net/http: fix ResponseWriter.ReadFrom with short readsDamien Neil
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-02net: don't rely on system hosts in TestCVE202133195Roland Shoemaker
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-05-27net/http: correct Client.Do doc about context cancelationManlio Perillo
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-27net: verify results from Lookup* are valid domain namesRoland Shoemaker
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-27Revert "net: verify results from Lookup* are valid domain names"Roland Shoemaker
This reverts commit c89f1224a544cde464fcb86e78ebb0cc97eedba2. 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-27net/http/httputil: always remove hop-by-hop headersFilippo Valsorda
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-24net: verify results from Lookup* are valid domain namesRoland Shoemaker
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-19cmd/internal/moddeps: use filepath.SkipDir only on directoriesDmitri Shuralyov
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-19net: return nil UDPAddr from ReadFromUDPMichael Pratt
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-14net/http: prevent infinite wait during TestMissingStatusNoPanicMichael Fraenkel
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-14all: fix spellingJohn Bampton
Change-Id: Id991d8e81e04835cabfb02d07a2199bfb553726c GitHub-Last-Rev: 5d0b55d49127a2e2ba3148d20a58c52debcae12b 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-11net/http: check that Unicode-aware functions are not usedFilippo Valsorda
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-10net/http: switch HTTP1 to ASCII equivalents of string functionsRoberto Clapis
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-10net, runtime: drop macOS 10.12 skip conditions in testsTobias Klauser
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-05net/http: ignore directory path when parsing multipart formsKatie Hockman
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-05all: update vendored dependencies for Go 1.17Alexander Rakoczy
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-04net/url: avoid string concatenation in resolvePathIan Lance Taylor
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-03net/http: use relative path in Location redirectRoland Shoemaker
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-04-30net/url: add Values.HasIan Mckay
Adds a method within Values for detecting whether a query parameter is set. Fixes #45100 Change-Id: I6bb49417e8547e11cc7e8d55c5211d24ee436ec1 GitHub-Last-Rev: 0b27cdab9024b93bad1eab9941aff8928a29fa76 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-21net: don't check nil err twice in interfaceMessages on freebsdTobias Klauser
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-20net: pass MSG_CMSG_CLOEXEC in ReadMsgUnix on dragonfly, netbsd and openbsdTobias Klauser
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-20internal/poll, net: fix comments regarding accept and sysSocketTobias Klauser
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-20net: use syscall.fcntl on libc systemsIan Lance Taylor
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-19net: pass MSG_CMSG_CLOEXEC flag in ReadMsgUnixHowJMay
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: ca59e2c9e0e8de1ae590e9b6dc165cb768a574f5 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-16net/http/fcgi: eliminate race, keep request id until end of stdinHilko Bengen
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: b3976111ae1d3bbbfa36045f99acce7911a18c44 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-16net/http/cgi: Remove hard-coded ServeHTTP timeoutHowJMay
Close #43624 Change-Id: Ifaea3d8ec2aeabbd923abf5edd7497172dbf855a GitHub-Last-Rev: ea3ef953a1dbbb07c4554e4062571af716e9505b 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-16net/http: make ReadRequest return an error when requests have multiple Host ↵ian woolf
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-16net/http: using errors.Is in fs error detectionPeng Gao
Compare error by errors.Is to detect wrapped fs errors. Fixes #44923 Change-Id: Idf32b96a661728278b7006c3b3bcc581b8588259 GitHub-Last-Rev: dba01ddae06947fb8c6047ddfba108acd650f446 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>