Commit Graph

1602 Commits

Author SHA1 Message Date
Tobias Klauser
6ef6e9bdcb ipv4: use socket option consts from x/sys/unix on aix
Use the socket option constants defined in the golang.org/x/sys/unix
package instead of duplicating them in this package.

Note that for now, sysIP_RECVDSTADDR, sysIP_RECVIF and sysIP_RECVTTL
still need to be defined because they are used in code shared with other
platforms.

Change-Id: I2b3b8621108c9399f1d36bab97c65fd349fa0839
Reviewed-on: https://go-review.googlesource.com/c/net/+/304712
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-03-26 22:08:43 +00:00
Tobias Klauser
6b15177628 ipv4: use socket option consts from x/sys/unix on solaris
Use the socket option constants defined in the golang.org/x/sys/unix
package instead of duplicating them in this package.

Note that for now, sysIP_RECVDSTADDR, sysIP_RECVIF, sysIP_RECVTTL and
sysIP_PKTINFO still need to be defined because they are used in code
shared with other platforms.

Change-Id: I900ac4460d350d5d8959d34db339831657b7e03f
Reviewed-on: https://go-review.googlesource.com/c/net/+/304711
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-03-26 06:03:03 +00:00
Tobias Klauser
ef31e18dbd ipv4: use socket option consts from x/sys/unix on netbsd and openbsd
Use the socket option constants defined in the golang.org/x/sys/unix
package instead of duplicating them in this package.

Note that for now, sysIP_RECVDSTADDR, sysIP_RECVIF and sysIP_RECVTTL
still need to be defined because they are used in code shared with other
platforms.

Change-Id: I6a6b39e94ec123889c08b55bc469ad51107399cb
Reviewed-on: https://go-review.googlesource.com/c/net/+/304710
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-03-26 06:02:29 +00:00
Tobias Klauser
f475aed52b ipv4: use socket option consts from x/sys/unix on freebsd
Use the socket option constants defined in the golang.org/x/sys/unix
package instead of duplicating them in this package.

Note that for now, sysIP_RECVDSTADDR, sysIP_RECVIF and sysIP_RECVTTL
still need to be defined because they are used in code shared with other
platforms.

Change-Id: Ic937ccbc0a554c8dd6e0b9f36b1601ba86f62f5f
Reviewed-on: https://go-review.googlesource.com/c/net/+/304709
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-26 06:01:27 +00:00
Tobias Klauser
d1beb07c20 ipv4: use socket option consts from x/sys/unix on linux
Use the socket option constants defined in the golang.org/x/sys/unix
package instead of duplicating them in this package.

Note that for now, sysIP_PKTINFO and sysIP_RECVTTL are still needed
because they are used in code shared with other platforms.

Change-Id: Iae627111837a3707fc9079d490d11e34ee3365cf
Reviewed-on: https://go-review.googlesource.com/c/net/+/304330
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-03-24 20:56:30 +00:00
Tobias Klauser
3061449911 go.mod: update golang.org/x/sys to v0.0.0-20210324051608
This pulls in additional IP socket option constants.

Change-Id: If8029a621cc5f9fdb1abfdc84561a2969b61bfd6
Reviewed-on: https://go-review.googlesource.com/c/net/+/304329
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-03-24 20:56:11 +00:00
Tobias Klauser
2c4c8ecb78 ipv4: use socket option consts from x/sys/unix on darwin
Use the socket option constants defined in the golang.org/x/sys/unix
package instead of duplicating them in this package.

Note that for now, sysIP_RECVDSTADDR, sysIP_RECVIF, sysIP_RECVTTL and
sysIP_PKTINFO still need to be defined because they are used in code
shared with other platforms.

Change-Id: I9bb953dc72dea19e9e9d84dc641346fe95bad070
Reviewed-on: https://go-review.googlesource.com/c/net/+/303909
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-24 05:16:36 +00:00
Tobias Klauser
08027d57d8 internal/socket: skip known flaky TestRace
This test keeps flaking on almost every TryBot run. Skip it for now.

For golang/go#37338

Change-Id: I77cdd782f3bc164ec11894683aa50c3441807ba5
Reviewed-on: https://go-review.googlesource.com/c/net/+/303910
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-03-23 14:18:57 +00:00
Tobias Klauser
d523dce5a7 ipv4, ipv6: use IP_* socket option constants from x/sys/windows
Use the IP_* socket option constants defined in the
golang.org/x/sys/windows package instead of defining them locally.

Change-Id: Ie6e79b7984795c409a01bd57134090bb720ea4b3
Reviewed-on: https://go-review.googlesource.com/c/net/+/301810
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-16 09:26:52 +00:00
Tobias Klauser
34ac3e1c20 ipv4: remove unused type inetPktinfo
This type is not used in this package on windows and it is no
corresponding C type defined in the Windows API C headers.

Change-Id: Ic581331d1f04599369361e26d8b38cf2e32241ab
Reviewed-on: https://go-review.googlesource.com/c/net/+/301809
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-15 17:06:53 +00:00
Luke Shumaker
e18ecbb051 http2/h2c: Respect the req.Context()
When using h2c.NewHandler, the *http.Request object for h2c requests has a
.Context() that doesn't inherit from the *http.Server's BaseContext.  This
is surprising for users of vanilla net/http, and is surprising to users of
http2.ConfigureServer; HTTP/1 requests inherit from that BaseContext, and
TLS h2 requests inherit from that BaseContext, but cleartext h2c requests
don't.

So, modify h2c.NewHander to respect that base Context, by way of the
hijacked Request's .Context().

Change-Id: Ibc24ae6e2fb153d9561827ad791329487dae8e5a
GitHub-Last-Rev: 821b2070f7
GitHub-Pull-Request: golang/net#88
Reviewed-on: https://go-review.googlesource.com/c/net/+/278972
Reviewed-by: Liam Haworth <liam@haworth.id.au>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2021-02-26 17:20:49 +00:00
Ashish Bhate
39120d07d7 http2: discard DATA frames with higher stream IDs during graceful shutdown
If the server sends a GOAWAY at the same time that a client sends
HEADERS+DATA, the server will discard the HEADERS, but error on the DATA
frame. Luckily, the server doesn't turn this into a connection error
because it's already in a GOAWAY state. It just logs the PROTOCOL_ERROR,
but that produces a confusing log message.

This change effectively suppresses the log message by discarding the
DATA frame rather than erroring on it. Also, we now discard any frames for
streams with identifiers higher than the identified last stream. This is
done as per section 6.8 of the HTTP2 spec.

I also updated some stale documentation while I was trying to understand
the logic.

This is CL 188360 with a test

Fixes golang/go#32112

Co-authored-by: Yunchi Luo <mightyguava@gmail.com>
Co-authored-by: Michael Fraenkel <michael.fraenkel@gmail.com>

Change-Id: I612c2bd82e37551e813af0961b16a98d14e77c38
Reviewed-on: https://go-review.googlesource.com/c/net/+/237957
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Damien Neil <dneil@google.com>
2021-02-26 10:14:13 +00:00
Tobias Klauser
3d97a244fc internal/socket: check for EWOULDBLOCK on all platforms
Don't make the check for EWOULDBLOCK zos-specific. Most platforms define
EAGAIN and EWOULDBLOCK with the same underlying value. Thus, the
additional check will be a no-op on them. On platforms where EAGAIN and
EWOULDBLOCK have different underlying values, we probably want to check
both as well.

As pointed out by Michael Munday in CL 264028.

Change-Id: Id3404fc4440c66a3484975b4c94b4ebb788b80a1
Reviewed-on: https://go-review.googlesource.com/c/net/+/295569
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-24 08:20:22 +00:00
Michael Fraenkel
9060382bd4 http2: rework Ping test to rely less on timing
Pings are either expected to occur, so count until you reach your goal
before a deadline, or they do not occur, and the deadline is exceeded.

Fixes golang/go#42514

Change-Id: If9ff19ed4954bee83ddeba83a4ac9c2d43f6e1c1
Reviewed-on: https://go-review.googlesource.com/c/net/+/269797
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Damien Neil <dneil@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-02-22 17:17:44 +00:00
Russ Cox
5f55cee0dc all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I5b2b7d93424e828a3c5f76ae3f30ab825aca388e
Reviewed-on: https://go-review.googlesource.com/c/net/+/294371
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-20 03:31:24 +00:00
Tobias Klauser
5f4716e947 ipv6: skip known-failing tests on openbsd-{arm,arm64,mips64}-jsing builders
The arm64 and mips64 builder run OpenBSD 6.8:

openbsd-arm64-jsing:
OpenBSD gopher-arm64.sing.id.au 6.8 GENERIC.MP#2 arm64

openbsd-mips64-jsing:
OS: OpenBSD er4.sing.id.au 6.8 GENERIC.MP#0 octeon

The openbsd-arm-jsing builder was offline but according to
https://github.com/golang/go/issues/25498#issuecomment-636295933
it's running at least OpenBSD 6.7. Assuming that this version is
affected as well (or the builder was upgraded to 6.8 in the meantime),
skip TestPacketConnReadWriteMulticastUDP on this builder as well.

For golang/go#11811.
Updates golang/go#42064.

Change-Id: Ia9919057bfc2a69b8884228508ae919ce9d624e9
Reviewed-on: https://go-review.googlesource.com/c/net/+/283752
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2021-01-19 19:43:25 +00:00
Dmitri Shuralyov
6772e930b6 ipv6: skip known-failing tests on OpenBSD 6.8 builders
These tests are known to be failing on OpenBSD 6.8 and need
investigation. The OpenBSD 6.8 builders are default TryBots
now, so skip them to prevent people working on other packages
from constantly getting a failure.

Issue 42064 remains open to do the work of determining if the
ipv6 package needs to be fixed, or if OpenBSD 6.8 has a problem
and the test can be permanently skipped as unsupported.

For golang/go#11811.
Updates golang/go#42064.
Updates golang/go#35712.

Change-Id: I59883384e4dbce679cb1a4e8e2c3f0fa7983010b
Reviewed-on: https://go-review.googlesource.com/c/net/+/280052
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-24 01:40:10 +00:00
Volker Dobler
986b41b239 publicsuffix: update table to latest list from publicsuffix.org
Update the list to revision f9f612a3386dd9a1e4a1892722e3418549520b49
(2020-11-30T21:55:23Z).

Change-Id: I0825f6843cee74123b1a5ebb30f79f967cd39c41
Reviewed-on: https://go-review.googlesource.com/c/net/+/275476
Trust: Nigel Tao <nigeltao@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-12-16 05:46:12 +00:00
Tobias Klauser
ac852fbbde http2/h2i: use x/term instead of x/crypto/ssh/terminal
The x/crypto/ssh/terminal package was moved to x/term in CL 258001 and
the implementation replaced by wrappers in CL 258003. Use x/term
directly to reduce dependencies.

Change-Id: I4cf50bde60f8534e633cb4989da342af279203ec
Reviewed-on: https://go-review.googlesource.com/c/net/+/275477
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-12-09 12:38:23 +00:00
Julie Qiu
747e23833a README.md: add badge to pkg.go.dev
Change-Id: I10b527ce21a609b674aa517cccaecd75c5aeef2e
Reviewed-on: https://go-review.googlesource.com/c/net/+/275889
Trust: Julie Qiu <julie@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-07 22:46:15 +00:00
Tobias Klauser
c7110b5ffc internal/socket: add support for openbsd/mips64
For golang/go#40995

Change-Id: I415ce04a3fb419de933ab4bb5d2afbacbbaff80c
Reviewed-on: https://go-review.googlesource.com/c/net/+/274772
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2020-12-02 16:19:06 +00:00
Michael Fraenkel
5d6afe98e0 http2: send a nil error if we cancel a delayed body write
Once a request body is scheduled to be written, a result of the write is always
expected. If the body writer is cancelled, and the write was never started,
send a successful result.

The test included is a modified version of the TestNoSniffExpectRequestBody_h2 found
in net/http.

Updates golang/go#42498

Change-Id: If3f23993170bdf10e9ae4244ec13ae269bd3877a
Reviewed-on: https://go-review.googlesource.com/c/net/+/269058
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-12-01 19:55:09 +00:00
Michael Fraenkel
69a78807bb http2: remove the timeout since we don't know a good value
The test is expected to finish so rather than wait on some arbitrary
timeout, let the go test timeout show us where things went wrong.

Fixes golang/go#42381

Change-Id: Ia9405f9f75b2f5f73ed3f8a540a74b7c64066ad0
Reviewed-on: https://go-review.googlesource.com/c/net/+/267977
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2020-11-10 03:11:24 +00:00
Michael Fraenkel
a11eb1b685 http2: wait for both client and server funcs
When executing the clienttester.run(), it would exit when both
the client and server completed successfully or if either side failed.
If one side fails, the other side may not have finished. If an error was
reported, the goroutine was caught executing after the test completed.

The expectation is always that both sides complete successfully. In the
case where one side fails, we still need to wait for the other side to
complete.

Close both client and server connections on error to expedite the
completion.

Fixes golang/go#41299

Change-Id: If47fbe61de42495bb2b1327bd5b03d6c295670dc
Reviewed-on: https://go-review.googlesource.com/c/net/+/267760
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2020-11-09 17:26:40 +00:00
Michael Fraenkel
ff519b6c91 net/http2: wait until the request body has been written
When the clientConn is done with a request, if there is a request body,
we must wait until the body is written otherwise there can be a race
when attempting to rewind the body.

Fixes golang/go#31192
Fixes golang/go#41234

Change-Id: I77606cc19372eea8bbd8995102354f092b8042be
Reviewed-on: https://go-review.googlesource.com/c/net/+/253259
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-31 05:49:03 +00:00
Kunpei Sakai
28c70e62bb html: port html5lib tests from html5lib/html5lib-tests
To reproduce this, execute following steps in order:

1. git clone git@github.com:html5lib/html5lib-tests.git && git checkout 6ddcf58bea5a01e616911050c173622f84297211
2. cp -Rv html5lib-tests/tree-construction/ testdata/webkit

Change-Id: Id32798b1ff881afad82d87c2fef0841e5223c7e6
Reviewed-on: https://go-review.googlesource.com/c/net/+/263397
Trust: Kunpei Sakai <namusyaka@gmail.com>
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-10-29 22:17:08 +00:00
Kunpei Sakai
942e2f445f html: avoid using raw text mode even when nested noscript tags
Assuming "in head noscript" insertion mode, the scripting flag will be disabled.
Thus, even if nested noscript tags exist,
the tokenizer should not go into the raw text mode.

This change makes the following test happy:
<head><noscript><noscript class="foo"><!--foo--></noscript>

Change-Id: I2620e751d8be3d313c3a2e2f992b1e21ce2dc2ee
Reviewed-on: https://go-review.googlesource.com/c/net/+/263878
Trust: Kunpei Sakai <namusyaka@gmail.com>
Trust: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-10-29 05:50:24 +00:00
Kunpei Sakai
8adf50f3fe html: avoid using raw text mode if there are raw tags to be ignored in select IM
This follows up on https://golang.org/cl/264977

Change-Id: I5d0e2f39173a8bbd07ca53de4df2a7e8772d4197
Reviewed-on: https://go-review.googlesource.com/c/net/+/265960
Trust: Kunpei Sakai <namusyaka@gmail.com>
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-10-29 05:33:32 +00:00
Kunpei Sakai
e0495509cf html: skip tests for behavior outside the parsing algorithm
This also updates webkit/tests18.dat to latest.

Change-Id: I4ed37e918a7db63afd8d515dd3a2494699cc5b74
Reviewed-on: https://go-review.googlesource.com/c/net/+/264977
Trust: Kunpei Sakai <namusyaka@gmail.com>
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-10-29 03:25:33 +00:00
Marcel van Lohuizen
8eef5233e2 idna: upgrade to Unicode 13
Change-Id: I4f95287e518eb1284bd03b39d667c256f6ce9d20
Reviewed-on: https://go-review.googlesource.com/c/net/+/265022
Trust: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-27 13:37:19 +00:00
billofarrell
146b70c837 all: add support for zos/s390x
This adds net support for zos/s390x. These changes should not affect other platforms.

Fixes golang/go#42130

Change-Id: Ia7faa29de76b7c5713120657b296106c2e27bfd2
Reviewed-on: https://go-review.googlesource.com/c/net/+/264028
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-26 09:15:29 +00:00
Michael Fraenkel
be3efd7ff1 net/http2: wait for test goroutines to complete
Don't assume goroutines are gone immediately. Any error that occurs will
cause a panic after the test completes.

Fixes golang/go#41299

Change-Id: I00d3e246fd0b265a33a5dc1a536a33866df30d75
Reviewed-on: https://go-review.googlesource.com/c/net/+/254278
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Chao Xu <xuchao@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-24 04:28:10 +00:00
Damien Neil
08b38378de http2: add ConfigureTransports
The ConfigureTransport function doesn't provide any way to get at the
http2 Transport it creates, making it impossible to configure transport
parameters such as ReadIdleTimeout.

Add a ConfigureTransports function which returns the http2 Transport.

The very similar names are unfortunate, but they'll sort next to each
other in godoc and the pluralized ConfigureTransports hints at its purpose:
it lets you configure both the http and http2 transports.

Fixes golang/go#40201.
Updates golang/go#41721.

Change-Id: I97aa345f369f49462c41d3f60d35660c06c51287
Reviewed-on: https://go-review.googlesource.com/c/net/+/264017
Trust: Damien Neil <dneil@google.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-10-22 23:12:55 +00:00
Michael Fraenkel
f5854403a9 http2: close Transport connection on write errors
When a new connection is created, and a write error occurs during the
initial exchange, the connection must be closed. There is no guarantee
that the caller will close the connection.

When a connection with an existing write error is used or being used, it
will stay in use until its read loop completes. Requests will continue
to use this connection and fail when writing its header. These
connections should be closed to force the cleanup in its readLoop.

Fixes golang/go#39337

Change-Id: I45e1293309e40629531f4cbb69387864f4f71bc2
Reviewed-on: https://go-review.googlesource.com/c/net/+/240337
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Damien Neil <dneil@google.com>
2020-10-21 03:54:29 +00:00
Kunpei Sakai
d65d470038 html: remove a few attributes from svg attribute adjustments
As per the current spec, "contentScriptType", "contentStyleType" and
"externalResourcesRequired" have been removed from the svg attribute adjustments.

See: https://html.spec.whatwg.org/multipage/parsing.html#adjust-svg-attributes

Change-Id: I904914691c3a3c3958868f7e49ba10f7d6f9ec09
Reviewed-on: https://go-review.googlesource.com/c/net/+/263398
Trust: Kunpei Sakai <namusyaka@gmail.com>
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-10-20 06:53:57 +00:00
Michael Fraenkel
7b1cca2348 http/httpproxy: match http scheme when selecting http_proxy
Protocol specific proxies must match based on scheme.

If the https proxy is no configured, and the proxy for a https URL is
requested, no proxy should be returned.

Updates golang/go#40909

Change-Id: I62dfcf95d819c634e8f2862e891877a4eb55fca7
Reviewed-on: https://go-review.googlesource.com/c/net/+/249440
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2020-10-16 16:51:38 +00:00
Kunpei Sakai
4f7140c49a html: add comments indicating that these have been removed from the spec
Change-Id: I44e9234fa4dc65f2b23b3a9f31ffe9d9fcefc4f1
Reviewed-on: https://go-review.googlesource.com/c/net/+/261177
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Trust: Nigel Tao <nigeltao@golang.org>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>
2020-10-10 22:47:23 +00:00
Tamir Duberstein
dbdefad45b ipv4: refactor multicast tests to use subtests
- Improve error discipline
- Narrow test types from net.UDPAddr to net.IPAddr where possible

Change-Id: I6c403ae69685ac3f35e427f56027fe4a29fde540
Reviewed-on: https://go-review.googlesource.com/c/net/+/260679
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-10-09 03:24:41 +00:00
Alexey Vilenski
59f7323070 xsrftoken: add custom timeout support for valid func
Added new function 'ValidFor' with custom token timeout support.
Function 'Valid' will use default token timeout.

Fixes golang/go#41438

Change-Id: I5cf0388aeed7ca34edcb0d3493c3e79c8ce19938
GitHub-Last-Rev: 3e3b581796
GitHub-Pull-Request: golang/net#86
Reviewed-on: https://go-review.googlesource.com/c/net/+/260317
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
2020-10-08 22:28:04 +00:00
Radek Simko
a7d1128cca go.mod: bump golang.org/x/text to v0.3.3
This upgrades golang.org/x/text to 0.3.3 (which addresses CVE-2020-14040).

Change-Id: I39bbb1378a9dfe643032f3139e4bb3265b6befb8
GitHub-Last-Rev: 28e29fba21
GitHub-Pull-Request: golang/net#83
Reviewed-on: https://go-review.googlesource.com/c/net/+/254960
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Trust: Matt Layher <mdlayher@gmail.com>
2020-10-06 15:34:59 +00:00
Tobias Klauser
0a1ea396d5 internal/socket: use Cmsg{Len,Space} from golang.org/x/sys/unix
Instead of duplicating the logic for cmsg alignment, use CmsgLen and
CmsgSpace from golang.org/x/sys/unix. Moreover, this should simplify
adding new ports.

Change-Id: Ic3ac9cf14781eff5b8e4f34bfd2b1c8bd3b69341
Reviewed-on: https://go-review.googlesource.com/c/net/+/259058
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-02 20:24:02 +00:00
Tobias Klauser
3d0752d450 go.mod: update golang.org/x/sys to v0.0.0-20200930185726-fdedc70b468f
Make sure to get correct cmsg alignment for all platform, namely CL
258457 for netbsd/arm64.

In an upcoming CL, this repo will switch to use cmsg alignment funcs
from x/sys/unix.

Change-Id: I7aab54badcbfe363c8840ab3bbe0a45c589e4b1b
Reviewed-on: https://go-review.googlesource.com/c/net/+/259057
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-02 20:23:53 +00:00
Tobias Klauser
4acb6c075d internal/socket: use correct cmsg alignment for netbsd/arm64
netbsd/arm64 requires 128-bit alignment for cmsgs.

Change-Id: I8e45e7d7f6b09d3c128d932dc5a73e3f2bd3a269
Reviewed-on: https://go-review.googlesource.com/c/net/+/258377
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-09-30 14:50:03 +00:00
Michael Fraenkel
5d4f700557 net/http2: send WINDOW_UPDATE on a body's write failure
When the body.Write fails during processData, the connection flow
control must be updated to account for the data received. The connection's
WINDOW_UPDATE should reflect the amount of data that was not successfully
written. The stream is about to be closed, so no update is required.

Fixes golang/go#40423

Change-Id: I546597cedf3715e6617babcb3b62140bf1857a27
Reviewed-on: https://go-review.googlesource.com/c/net/+/245158
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>
2020-09-27 03:25:02 +00:00
Tobias Klauser
05aa5d4ee3 internal/socket, route: drop support for pre-1.12 direct syscalls on darwin
Go 1.12 and newer are using libSystem for syscalls on darwin.
Go 1.11 is the last release to use direct syscalls. It hasn't been
supported since the release of Go 1.13 in September 2019, so drop
support for direct syscalls on darwin from golang.org/x/net.

Change-Id: Ib53d64e8a6d12ad702951f8efc123ce92c01c4d9
Reviewed-on: https://go-review.googlesource.com/c/net/+/257057
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>
2020-09-25 08:00:53 +00:00
Cherry Zhang
328152dc79 all: add GOOS=ios
Following CL 254740, this CL does it on x/net.

Updates golang/go#38485.

Change-Id: I80831dd0faa6f216d8d3b8f1af0af811aacce43f
Reviewed-on: https://go-review.googlesource.com/c/net/+/255537
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-09-23 18:22:12 +00:00
Paschalis Tsilias
62affa334b x/net/http2: reject HTTP/2 Content-Length headers containing a sign
Continuing the work of CL 234817, we enforce the same for HTTP/2
connections; that Content-Length header values with a sign (such as
"+5") are rejected or ignored. In each place, the handling of such
incorrect headers follows the approach already in place.

Fixes golang/go#39017

Change-Id: Ie4854962dd0091795cb861d1cb3a78ce753fd3a8
Reviewed-on: https://go-review.googlesource.com/c/net/+/236098
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-09-04 19:48:48 +00:00
Michael Fraenkel
c890458142 net/http2: fix erringRoundTripper
The http transport added a new interface to detect RoundTrippers that
always error. Prior to this, the erringRoundTripper would not be
identified as such and a new connection was always created.

Updates golang/go#40213

Change-Id: Icc315dcc9ce8ea0db94a1f2c58c6a741675d8962
Reviewed-on: https://go-review.googlesource.com/c/net/+/243257
Reviewed-by: Chris Friesen <cbf123@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-08-22 12:43:28 +00:00
Volker Dobler
3edf25e44f publicsuffix: update table to latest list from publicsuffix.org
Update the list to revision revision bdbe9dfd268d040fc826766b1d4e27dc4416fe73
(2020-08-10T09:26:55Z).

Change-Id: Id9f7e15572189aa1c0a5553618a71fde1d8cb410
Reviewed-on: https://go-review.googlesource.com/c/net/+/248117
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-08-13 13:45:08 +00:00
Russ Cox
ab34263943 dns/dnsmessage: remove use of fmt that crept in
This package cannot use fmt, because standard package net imports it.
(Most of the package is already clean, including Type.String.)

For golang/go#40070.

Change-Id: I9be92e98d9f5dcfb26852d38004e05f07df5e17a
Reviewed-on: https://go-review.googlesource.com/c/net/+/241085
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-07-07 03:43:11 +00:00