aboutsummaryrefslogtreecommitdiff
path: root/src/net
AgeCommit message (Collapse)Author
2022-01-10net/http: map FS Open errors just like DirJonathan Amsterdam
When an http.FileServer is given a path like file1/file2 where file1 exists but file2 does not, the proper HTTP status should be NotFound. Some OSes return a "not a directory" error instead, so this must be mapped to NotFound. That mapping was already being done for the Dir FileSystem implementation, as discussed in #18984. But it wasn't for the FS implementation. This CL does the same mapping for FS, by generalizing the function that did it for Dir. Fixes #49552 Change-Id: I61d6aa8ef101158e9674707d44e653f5dedbd040 Reviewed-on: https://go-review.googlesource.com/c/go/+/376874 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-01-08net/http/internal/testcert: use FIPS-compliant certificateDamien Neil
Upgrade the test certificate from RSA 1024 (not FIPS-approved) to RSA 2048 (FIPS-approved), allowing tests to pass when the dev.boringcrypto branch FIPS-only mode is enabled. Fixes #48674. Change-Id: I613d2f8d0207bf3683fd0df256bf0167604996c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/353869 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2022-01-06net: synchronize instead of sleeping in TestDialParallelSpuriousConnectionBryan C. Mills
The arbitrary sleep in this test is empirically not always long enough on slower builders. However, we know the exact number of connections that should be dialed: we can wait on that number in the dial hook instead. Fixes #34495 Change-Id: I538244ceb75a80271a724304b993309482bd5b41 Reviewed-on: https://go-review.googlesource.com/c/go/+/375694 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-01-05net/http: skip TestClientTimeout_h{1,2} on windows/arm and windows/arm64Bryan C. Mills
These tests are empirically flaky on the windows/arm and windows/arm64 builders, with a consistent (but rare) failure mode. This change skips the test if that particular failure mode is encountered on those platforms; the skip can be removed if and when someone has the time to pin down the root cause. For #43120 Change-Id: Ie3a9a06bf47e3a907c7b07441acc1494a4631135 Reviewed-on: https://go-review.googlesource.com/c/go/+/375635 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-01-05net: do not panic on nil IPNet.String()Jason A. Donenfeld
The code looks like it was already trying to avoid this but missed a spot. Fixes #50271. Change-Id: I450adac3f618b9535b61a28e6a160eacc351d47c Reviewed-on: https://go-review.googlesource.com/c/go/+/373075 Trust: Jason Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason Donenfeld <Jason@zx2c4.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-21net/http: fix link to ResponseWriter trailer exampleReilly Watson
The links to this example were using an underscore separator instead of a hyphen, and incorrect casing. Fixes #50279 Change-Id: I35d76a8a78cd708b7505ff1a70f7dacddaf43efd Reviewed-on: https://go-review.googlesource.com/c/go/+/373514 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-12-20net/netip: add a fuzz testAndrew LeFevre
This is a pretty straight port of the fuzz test at https://github.com/inetaf/netaddr. The MarshalText methods of netip.Addr and net.IP, the Is* methods of netip.Addr and net.IP and the MarshalText and String methods of netip.Addr are also checked to ensure that they behave the same way. Fixes #49367 Change-Id: I44abb01f2a7af45f39597992a1fc7ff0305728fa GitHub-Last-Rev: c2323b0ae119b804a58b810ad7f0e2bb1b3a38ac GitHub-Pull-Request: golang/go#50108 Reviewed-on: https://go-review.googlesource.com/c/go/+/371055 Trust: Matt Layher <mdlayher@gmail.com> Trust: Katie Hockman <katie@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
2021-12-17net: lengthen arbitrary SetDeadline timeout by a few orders of magnitudeBryan C. Mills
The "someTimeout" constant in the net test is “just to test that net.Conn implementations don't explode when their SetFooDeadline methods are called”. It was set to 10 seconds, which is short enough that it could actually matter on some platforms. Since the point of the constant is just to make sure methods don't explode, we should set it to be at least a couple of orders of magnitude longer than the test: then it is guaranteed not to have any unintended side-effects. Fixes #50227 Change-Id: If97ae7bef5e7f16b336d09ccc37f5ea2ea7e70b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/372796 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-16net/http/pprof: skip TestDeltaProfile on openbsd/armBryan C. Mills
It is observed to be flaky on the only openbsd/arm builder. Skipping on that platform until someone can investigate. For #50218 Change-Id: Id3a6dc12b93b3cec67870d8d81bd608c4589c952 Reviewed-on: https://go-review.googlesource.com/c/go/+/372794 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-15net: increase timing slop in TimeoutFluctuation tests on NetBSD and OpenBSDBryan C. Mills
Decrease the slop everywhere else, since NetBSD and OpenBSD seem to be the only ones that miss by that much. For #50189 Updates #36108 Change-Id: I22ac39cc7c254e40358fcd933b5a6016629602c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/372215 Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-15net: skip Lookup tests of external hosts on builders with flaky networksBryan C. Mills
For #50191 Change-Id: Ic1059127e756d69ea9b75cf5805669ec43fedd5c Reviewed-on: https://go-review.googlesource.com/c/go/+/372216 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-15net: eliminate arbitrary timeout in TestVariousDeadlinesBryan C. Mills
When we set a timeout, we don't actually have a guarantee one how long the OS will take to notice it. Moreover, if the test deadlocks completely (for example, due to a deadline never taking effect), it would be more useful to get a full goroutine dump instead of the current "client stuck in Dial+Copy" failure message. For #37883 For #41863 Change-Id: I9f712ef1c620f97a5ab69baac45deb71134b99bc Reviewed-on: https://go-review.googlesource.com/c/go/+/371994 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13net/http: revert h2_bundle.go formatting change from CL 368254Bryan C. Mills
h2_bundle.go is automatically generated from x/net/http2. Any formatting changes within that file need to be first made upstream. This brings the contents of h2_bundle.go back in line with the upstream generator, fixing the cmd/internal/moddeps test that is currently failing on the longtest builders. For #49884 Change-Id: I5757240b77e250e0026b8a52a0e867e1578ec2d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/371297 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13all: gofmt -w -r 'interface{} -> any' srcRuss Cox
And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13net: refactor TestWriteToTimeoutBryan C. Mills
The test cases for this test had listed specific errors, but the specific error values were ignored in favor of just calling isDeadlineExceeded. Moreover, ENOBUFS errors (which can legitimately occur in the test if the network interface also happens to be saturated when the timeout occurs) were not handled at all. Now the test relies only on the timeout: we iterate until we have seen two of the expected timeout errors, and if we see ENOBUFS instead of "deadline exceeded" we back off to give the queues time to drain. Fixes #49930 Change-Id: I258a6d5c935d9635b02dffd79e197ba9caf83ac8 Reviewed-on: https://go-review.googlesource.com/c/go/+/370882 Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13net: create unix sockets in unique directoriesBryan C. Mills
This change applies the same transformation as in CL 366774, but to the net package. testUnixAddr was using os.CreateTemp to obtain a unique socket path, but then calling os.Remove on that path immediately. Since the existence of the file is what guarantees its uniqueness, that could occasionally result in testUnixAddr returning the same path for two calls, causing the tests using those paths to fail — especially if they are the same test or are run in parallel. Instead, we now create a unique, short temp directory for each call, and use a path within that directory for the socket address. For #34611 Change-Id: I8e13b606abce2479a0305f7aeecf5d54c449a032 Reviewed-on: https://go-review.googlesource.com/c/go/+/370694 Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13net: pass a testing.TB to newLocal* helpersBryan C. Mills
Passing in an explicit testing.TB gives two benefits: 1. It allows the helper to fail the test itself, instead of returning an error to the caller. A non-nil error invariably fails the calling test, and none of these callers bother to add detail to the error when logging it anyway so returning the error just added noise to the test bodies. 2. It allows the helper to use t.Cleanup to perform any needed cleanup tasks, which will be used in CL 370695 to clean up temp directories used as namespaces for unix socket paths. For #34611 Change-Id: I805e701687c12de2caca955649369294229c10b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/370696 Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13net: don't check "invalid.invalid" lookup errors in TestLookupHostCancelBryan C. Mills
The exact error isn't actually relevant to the test, and may depend on whether the Go or cgo resolver is used. Also run the test in parallel, because it spends most of its time sleeping in between lookups. Fixes #38767 Fixes #43140 Change-Id: I2d64ffddf2eb114a69ed3242daa9a9e4a5679f67 Reviewed-on: https://go-review.googlesource.com/c/go/+/369037 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-13net: do not try to remove the LocalAddr of a unix socketBryan C. Mills
TestUnixAndUnixpacketServer deferred a call to os.Remove on the local address of a dialed unix domain socket, in an attempt to remove the socket from the server. However, that call appears to be neither necessary nor correct. In this test, the file that needs to be unlinked is the one attached to the listener — but the listener's Close method already does that (see the Unlink call in (*UnixListener).close), so there is no need for the test itself to do the same. Moreover, the local address is not something that is sensible to delete — on Linux, it is empirically always the literal string "@" — and the Addr returned by c.LocalAddr is not reliably non-nil on all platforms (see #34611). Since we don't need to do anything with the local address, we shouldn't. At best, this is a benign Remove of a file that doesn't exist anyway; at worst, it is a nil-panic. Fixes #34611 Change-Id: Ie072b3388d884d60e819d1df210fa7d3e2eed124 Reviewed-on: https://go-review.googlesource.com/c/go/+/370695 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-13net: remove erroneous Dial check in TestListenerCloseBryan C. Mills
TestListenerClose had been asserting that a Dial to the newly-closed address always fails, on the assumption that the listener's address and port would not be reused by some other listener that could then accept the connection. As far as I can tell, that assumption is not valid: the Dial after Close may well connect to a Listener opened for some other test, or even one opened by a completely different process running concurrently on the same machine. Fixes #38700 Change-Id: I925ed1b2ccb556135a2c5be0240d1789ed27d5fc Reviewed-on: https://go-review.googlesource.com/c/go/+/370666 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-12net/netip: make Prefix.MarshalText format 4-in-6 IPs consistentlyMatt Layher
Fixes #50115. Change-Id: Iac76e5b486d3a2a784583345eaeb22c31cc4a36d Reviewed-on: https://go-review.googlesource.com/c/go/+/371134 Trust: Matt Layher <mdlayher@gmail.com> Run-TryBot: Matt Layher <mdlayher@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-12net/netip: make AddrPort.MarshalText format 4-in-6 IPs consistentlyBrad Fitzpatrick
Thanks again to @capnspacehook. Fixes #50110 Change-Id: I1973bdea68eac9842b45f9524f62152e4f5342cf Reviewed-on: https://go-review.googlesource.com/c/go/+/371114 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Matt Layher <mdlayher@gmail.com> Trust: Matt Layher <mdlayher@gmail.com> Trust: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-12net/netip: fix formatting of IPv4-in-6 address with zoneBrad Fitzpatrick
Weird, but don't drop the zone when stringifying. Fixes #50111 Change-Id: I5fbccdfedcdc77a77ee6bafc8d82b8ec8ec7220c Reviewed-on: https://go-review.googlesource.com/c/go/+/371094 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matt Layher <mdlayher@gmail.com> Trust: Matt Layher <mdlayher@gmail.com> Trust: Ian Lance Taylor <iant@golang.org>
2021-12-10net: ignore EADDRINUSE errors when dialing to IPv4 from IPv6 on FreeBSDBryan C. Mills
The failure mode in #34264 appears to match https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210726. That bug was supposed to have been fixed in FreeBSD 12, but we're still observing failures specifically for the 6-to-4 case on FreeBSD 12.2. It is not clear to me whether FreeBSD 13.0 is also affected. For #34264 Change-Id: Iba7c7fc57676ae628b13c0b8fe43ddf2251c3637 Reviewed-on: https://go-review.googlesource.com/c/go/+/369157 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Trust: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-09net/http: update bundled golang.org/x/net/http2Filippo Valsorda
Pull in security fix 2d13015 http2: cap the size of the server's canonical header cache and 0a0e4e1 http2: Fix handling of expect continue 04296fa http2: prioritize RST_STREAM frames in random write scheduler Fixes #50058 Fixes CVE-2021-44716 Change-Id: Ia40a2e52fa240e54a83b5ec7d8116cb6639ecbb9 Reviewed-on: https://go-review.googlesource.com/c/go/+/370579 Trust: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2021-12-08net/smtp: skip TestTLSSClient on all freebsd platformsBryan C. Mills
This test seems like it needs attention from a TLS and/or FreeBSD expert. In the meantime, it needs to stop causing noise on the build dashboard. For #19229 Change-Id: If7e9e3533ae7cb29006a670c3e9df90512dcf9f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/370137 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-08Revert "net: in (*netFD).dial, use the passed in local address if ↵Bryan Mills
getsockname fails" This reverts CL 366536 Reason for revert: may have caused #50033 due to an invalid or partially-populated *TCPAddr Fixes #50033 Change-Id: Ia29ca4116503dba65d56e89caa46ba1c848d421a Reviewed-on: https://go-review.googlesource.com/c/go/+/369982 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-07net/http: remove arbitrary timeout in TestServerHijackGetsBackgroundByte_bigBryan C. Mills
This test fails with "timeout" once per couple of months. It may be that the arbitrary timeout is too short, or it may be that the test is detecting a real bug (perhaps a deadlock) and reporting it without sufficient information to debug. Either way, the arbitrary timeout is doing only harm: either it is too short, or it is preventing us from getting a useful goroutine dump when the test inevitably times out. Fixes #35498 (hopefully). Change-Id: Ic6bbb1ef8df2c111b9888ba9903f58633e7cb95d Reviewed-on: https://go-review.googlesource.com/c/go/+/369854 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2021-12-07net: in (*netFD).dial, use the passed in local address if getsockname failsBryan C. Mills
'man getsockname' lists a number of possible failure modes, including ENOBUFS (for resource exhaustion) and EBADF (which we could possibly see in the event of a bug or race condition elsewhere in the program). If getsockname fails for an explicit user-provided local address, the user is probably not expecting LocalAddr on the returned net.Conn to return nil. This may or may not fix #34611, but should at least help us diagnose it more clearly. While we're add it, also add more nil-checking logic in the test based on the stack traces posted to https://golang.org/issue/34611#issuecomment-975923748. For #34611 Change-Id: Iba870b96787811e4b9959b74ef648afce9316602 Reviewed-on: https://go-review.googlesource.com/c/go/+/366536 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-06net: clarify that conn.LocalAddr and conn.RemoteAddr might not be knownBryan C. Mills
For #34611 Change-Id: I9a1357f53124c98ad017b58774696d0377dbea27 Reviewed-on: https://go-review.googlesource.com/c/go/+/369160 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02net: remove arbitrary deadlines in PacketConn testsBryan C. Mills
When TestPacketConn was added (in CL 6501057) it included arbitrary 100ms deadlines. Those deadlines were arbitrarily increased to 500ms in CL 4922. If the test is actually provoking a deadlock, allowing it to deadlock will give us a more useful goroutine dump. Otherwise, the deadlines don't seem all that useful — they appear to increase code coverage, but have no effect on the test in the typical case, and can only cause flakes on particularly-slow machines. For #43627 Change-Id: I83de5217c54c743b83adddf51d4f6f2bd5b91732 Reviewed-on: https://go-review.googlesource.com/c/go/+/368215 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-12-01net: do not use sendfile on iOSCherry Mui
Apparently, on the iOS builder sendfile causes a SIGSYS signal (instead of returning ENOSYS). Disabling it for now so we can make progress on iOS. We can revisit if sendfile is actually broken on iOS and whether it is beneficial. Updates #49616. Change-Id: I3883fad0ce35e3f0aa352301eb499a1afa0225a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/368054 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Changkun Ou <mail@changkun.de> Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-11-30net/http: eliminate arbitrary timeout in TestClientWriteShutdownBryan C. Mills
This test occasionally hangs on the darwin-arm64-11_0-toothrot builder. When it does, it fails with the unhelpful error message "timeout" instead of a useful goroutine dump. This change eliminates the use of an arbitrary timeout channel, so that if (and probably when) the test hangs again we will get more useful logs to diagnose the root cause. For #49860 Change-Id: I23f6f1c81209f0b2dbe565e1dfb26b1b2eff0187 Reviewed-on: https://go-review.googlesource.com/c/go/+/367615 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2021-11-29vendor: update golang.org/x/net to tipIan Lance Taylor
This brings in a fix for OpenBSD that lets it correctly gather network interface information. For #42064 Change-Id: Ib88fd2f494bb2ee86fd2725d8375b2df1404c4ca Reviewed-on: https://go-review.googlesource.com/c/go/+/366756 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-11-22net: allow more generous slop in Fluctuation testsBryan C. Mills
It appears that at least the OpenBSD kernel gets sloppier the longer the timeout we give it, up to an observed overhead of around 25%. Let's give it a little more than that (33%) in the comparison, and also increase the growth curve to match the actual observed times instead of exponential initial growth. Fixes #36108 Change-Id: Id3e54559b7c45b7c8bc0ca07dce74ca60e77e7ed Reviewed-on: https://go-review.googlesource.com/c/go/+/366176 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-11-22net: diagnose unexpected nils in TestUnixAndUnixpacketServerBryan C. Mills
For #34611 Change-Id: I31894d58498b2c290ecceccfc004bc817f8969c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/366114 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-19net: simplify deadline fluctuation testsBryan C. Mills
These tests were checking for fairly narrow timing windows, but were running in parallel and heavily dependent on timer and goroutine scheduling. This change eliminates unnecessary goroutines, runs the tests sequentially (dramatically shortening the timeouts to reduce the penalty of doing so), and uses timestamp comparison instead of background timers to hopefully gain some robustness from monotonic timestamps. Many of the other tests from this package would benefit from similar simplifications, which we can apply if and when we notice flaky failures or want to improve the latency of running the test. Fixes #36108 Change-Id: I17d8af7d2eefb1ec14fe0d9d891142a39599a562 Reviewed-on: https://go-review.googlesource.com/c/go/+/365334 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-11-18net: optimize ctxDone usageMikhail Faraponov
Change-Id: I6db6fcf0ebe36da77af062114b5264405f15fee8 GitHub-Last-Rev: 80a97262bb220bb3958c94016eadf385cdf915e8 GitHub-Pull-Request: golang/go#49620 Reviewed-on: https://go-review.googlesource.com/c/go/+/364514 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Trust: Damien Neil <dneil@google.com>
2021-11-12net/http: do not send Transfer-Encoding: identity in responsesDamien Neil
Server handlers may set a "Transfer-Encoding: identity" header on responses to disable chunking, but this header should not be sent on the wire. Fixes #49194. Change-Id: I46a9e3b8ff9d93edd7d1c34d264fc309fa322ad5 Reviewed-on: https://go-review.googlesource.com/c/go/+/359176 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-11-12net/http: do not cancel request context on response body readDamien Neil
When sending a Request with a non-context deadline, we create a context with a timeout. This context is canceled when closing the response body, and also if a read from the response body returns an error (including io.EOF). Cancelling the context in Response.Body.Read interferes with the HTTP/2 client cleaning up after a request is completed, and is unnecessary: The user should always close the body, the impact from not canceling the context is minor (the context timer leaks until it fires). Fixes #49366. Change-Id: Ieaed866116916261d9079f71d8fea7a7b303b8fb Reviewed-on: https://go-review.googlesource.com/c/go/+/361919 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-11-12net: use Done rather than comparing with context.BackgroundMikhail Faraponov
Fixes #49023 Change-Id: I3de70f8a25f4ba8a0fb8bb96581371e33fde2f7a GitHub-Last-Rev: b7ec9405adc77ec513df344f2ad33801feb2d3ca GitHub-Pull-Request: golang/go#49024 Reviewed-on: https://go-review.googlesource.com/c/go/+/356471 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Damien Neil <dneil@google.com>
2021-11-11net: skip new testpoint TestUDPIPVersionReadMsg on plan9Than McIntosh
Skip TestUDPIPVersionReadMsg on plan9, since it does things not supported on that OS. Change-Id: Icd1716fb5ed4e8877e57acb8c851ec3be72e83e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/363354 Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com> Trust: Than McIntosh <thanm@google.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-11-11net: add conversion from AddrPort to TCPAddr to complement existing inverseJason A. Donenfeld
We already have various member functions of TCPAddr that return an AddrPort, but we don't have a helper function to go from a AddrPort to a TCPAddr. UDP has this, but it was left out of TCP. This commit adds the corresponding function. Updates #49298. Change-Id: I85732cf34f47c792fe13a6b4af64fd4b0e85d06a Reviewed-on: https://go-review.googlesource.com/c/go/+/362596 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-10net: do more faithful conversion from AddrPort to UDPAddrJason A. Donenfeld
A UDPAddr with a nil IP is a valid state, representing an AF-agnostic unspecified address, so checking for addr.IsValid() isn't correct; remove that, as it's only needed in the UDP rx path where it can be added. Secondly, forcing everything to be IPv6 also is not correct, and was likely done when the missing .AsSlice() made doing the right thing less ergonomic. Fix this by using .AsSlice(), which properly preserves IP version. Change-Id: Idd1eaecd4076f32a843f859a0a9802ef98f956d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/361478 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2021-11-09all: update vendored golang.org/x/{net,text} for Go 1.18 releaseDmitri Shuralyov
The Go 1.18 code freeze has recently started. 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. This CL updates only the net, text modules. The next CL will update further ones. For #36905. Change-Id: I9a5ac3cca22da961cfd09f3202e01e1187d42bdd Reviewed-on: https://go-review.googlesource.com/c/go/+/362735 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
2021-11-09net/http: add MaxBytesHandlerCarl Johnson
Fixes #39567 Change-Id: I226089b678a6a13d7ce69f360a23fc5bd297d550 GitHub-Last-Rev: 6435fd5881fc70a276d04df5a60440e365924b49 GitHub-Pull-Request: golang/go#48104 Reviewed-on: https://go-review.googlesource.com/c/go/+/346569 Trust: Damien Neil <dneil@google.com> Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2021-11-08net/http: deflake TestTimeoutHandlerContextCanceledDamien Neil
Fixes #49448 Change-Id: Ie2acff7dedbca9bd1cc0b1b3dd0a01573c7befee Reviewed-on: https://go-review.googlesource.com/c/go/+/361920 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-11-07net/http: fix spelling in documentationjiahua wang
Change-Id: I8b0924300eafe27de98975512a78a6527a92e446 Reviewed-on: https://go-review.googlesource.com/c/go/+/354729 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Damien Neil <dneil@google.com>
2021-11-05net/netip: document the zero AddrJosh Bleecher Snyder
Fixes #49364 Change-Id: I3372f80723a4deae48ef106f88b0ad880cdd0e45 Reviewed-on: https://go-review.googlesource.com/c/go/+/361914 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-05net/netip: add tests for Addr.AsSliceJosh Bleecher Snyder
Change-Id: Ib88dd101b3bbdf4d2bfd79838994cfadef1b604d Reviewed-on: https://go-review.googlesource.com/c/go/+/361915 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Go Bot <gobot@golang.org>