]> Cypherpunks repositories - gostls13.git/commitdiff
vendor: update golang.org/x/net to tip
authorIan Lance Taylor <iant@golang.org>
Tue, 23 Nov 2021 20:34:04 +0000 (12:34 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 29 Nov 2021 19:21:29 +0000 (19:21 +0000)
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>

12 files changed:
src/go.mod
src/go.sum
src/net/http/h2_bundle.go
src/vendor/golang.org/x/net/lif/address.go
src/vendor/golang.org/x/net/lif/binary.go
src/vendor/golang.org/x/net/lif/lif.go
src/vendor/golang.org/x/net/lif/link.go
src/vendor/golang.org/x/net/lif/sys.go
src/vendor/golang.org/x/net/lif/syscall.go
src/vendor/golang.org/x/net/route/syscall.go
src/vendor/golang.org/x/net/route/syscall_go1_12_darwin.go [deleted file]
src/vendor/modules.txt

index b8c4d5c16b9f29e250d2b80ce8e77293def6db49..d26e4960b31287b1d9a4b7e76ed318be7229434b 100644 (file)
@@ -4,7 +4,7 @@ go 1.18
 
 require (
        golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa
-       golang.org/x/net v0.0.0-20211108170745-6635138e15ea
+       golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9
 )
 
 require (
index ff1288f81d2a7b4255312019d75214f39988e0d8..fddc4fbe936b6b36d3126a9d0a1c6bf7cf039a12 100644 (file)
@@ -1,7 +1,7 @@
 golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa h1:idItI2DDfCokpg0N51B2VtiLdJ4vAuXC9fnCb2gACo4=
 golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/net v0.0.0-20211108170745-6635138e15ea h1:FosBMXtOc8Tp9Hbo4ltl1WJSrTVewZU8MPnTPY2HdH8=
-golang.org/x/net v0.0.0-20211108170745-6635138e15ea/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 h1:0qxwC5n+ttVOINCBeRHO0nq9X7uy8SDsPoi5OaCdIEI=
+golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/sys v0.0.0-20211109065445-02f5c0300f6e h1:i6Vklmyu+fZMFYpum+sR4ZWABGW7MyIxfJZXYvcnbns=
 golang.org/x/sys v0.0.0-20211109065445-02f5c0300f6e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 h1:GLw7MR8AfAG2GmGcmVgObFOHXYypgGjnGno25RDwn3Y=
index 23a4d15326bee9eb264f8a85f3c52ca63145cd17..8d19c42b5adf27f5f46551cf1c7ff7aa20826c0c 100644 (file)
@@ -7830,36 +7830,49 @@ func (cc *http2ClientConn) RoundTrip(req *Request) (*Response, error) {
                }
        }
 
+       handleResponseHeaders := func() (*Response, error) {
+               res := cs.res
+               if res.StatusCode > 299 {
+                       // On error or status code 3xx, 4xx, 5xx, etc abort any
+                       // ongoing write, assuming that the server doesn't care
+                       // about our request body. If the server replied with 1xx or
+                       // 2xx, however, then assume the server DOES potentially
+                       // want our body (e.g. full-duplex streaming:
+                       // golang.org/issue/13444). If it turns out the server
+                       // doesn't, they'll RST_STREAM us soon enough. This is a
+                       // heuristic to avoid adding knobs to Transport. Hopefully
+                       // we can keep it.
+                       cs.abortRequestBodyWrite()
+               }
+               res.Request = req
+               res.TLS = cc.tlsState
+               if res.Body == http2noBody && http2actualContentLength(req) == 0 {
+                       // If there isn't a request or response body still being
+                       // written, then wait for the stream to be closed before
+                       // RoundTrip returns.
+                       if err := waitDone(); err != nil {
+                               return nil, err
+                       }
+               }
+               return res, nil
+       }
+
        for {
                select {
                case <-cs.respHeaderRecv:
-                       res := cs.res
-                       if res.StatusCode > 299 {
-                               // On error or status code 3xx, 4xx, 5xx, etc abort any
-                               // ongoing write, assuming that the server doesn't care
-                               // about our request body. If the server replied with 1xx or
-                               // 2xx, however, then assume the server DOES potentially
-                               // want our body (e.g. full-duplex streaming:
-                               // golang.org/issue/13444). If it turns out the server
-                               // doesn't, they'll RST_STREAM us soon enough. This is a
-                               // heuristic to avoid adding knobs to Transport. Hopefully
-                               // we can keep it.
-                               cs.abortRequestBodyWrite()
-                       }
-                       res.Request = req
-                       res.TLS = cc.tlsState
-                       if res.Body == http2noBody && http2actualContentLength(req) == 0 {
-                               // If there isn't a request or response body still being
-                               // written, then wait for the stream to be closed before
-                               // RoundTrip returns.
-                               if err := waitDone(); err != nil {
-                                       return nil, err
-                               }
-                       }
-                       return res, nil
+                       return handleResponseHeaders()
                case <-cs.abort:
-                       waitDone()
-                       return nil, cs.abortErr
+                       select {
+                       case <-cs.respHeaderRecv:
+                               // If both cs.respHeaderRecv and cs.abort are signaling,
+                               // pick respHeaderRecv. The server probably wrote the
+                               // response and immediately reset the stream.
+                               // golang.org/issue/49645
+                               return handleResponseHeaders()
+                       default:
+                               waitDone()
+                               return nil, cs.abortErr
+                       }
                case <-ctx.Done():
                        err := ctx.Err()
                        cs.abortStream(err)
@@ -7919,6 +7932,9 @@ func (cs *http2clientStream) writeRequest(req *Request) (err error) {
                return err
        }
        cc.addStreamLocked(cs) // assigns stream ID
+       if http2isConnectionCloseRequest(req) {
+               cc.doNotReuse = true
+       }
        cc.mu.Unlock()
 
        // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
@@ -8016,6 +8032,7 @@ func (cs *http2clientStream) writeRequest(req *Request) (err error) {
                case <-respHeaderTimer:
                        return http2errTimeout
                case <-respHeaderRecv:
+                       respHeaderRecv = nil
                        respHeaderTimer = nil // keep waiting for END_STREAM
                case <-cs.abort:
                        return cs.abortErr
@@ -9019,7 +9036,7 @@ func (rl *http2clientConnReadLoop) handleResponse(cs *http2clientStream, f *http
        cs.bytesRemain = res.ContentLength
        res.Body = http2transportResponseBody{cs}
 
-       if cs.requestedGzip && res.Header.Get("Content-Encoding") == "gzip" {
+       if cs.requestedGzip && http2asciiEqualFold(res.Header.Get("Content-Encoding"), "gzip") {
                res.Header.Del("Content-Encoding")
                res.Header.Del("Content-Length")
                res.ContentLength = -1
@@ -9158,7 +9175,10 @@ func (b http2transportResponseBody) Close() error {
        select {
        case <-cs.donec:
        case <-cs.ctx.Done():
-               return cs.ctx.Err()
+               // See golang/go#49366: The net/http package can cancel the
+               // request context after the response body is fully read.
+               // Don't treat this as an error.
+               return nil
        case <-cs.reqCancel:
                return http2errRequestCanceled
        }
index afb957fd8e15a38d411bc4b07efdce614d79d5ac..34b6432d6e2002a9fa65948832e42422c5096d16 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build solaris
 // +build solaris
 
 package lif
index 738a94f422409ddabb8b0a0bfdf0c74a204d4b69..f31ca3ad0726c9c315a42c6ba83480d8047cce3c 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build solaris
 // +build solaris
 
 package lif
index 6e81f81f1c2a855e57dad902efbb65bb484e31a9..95c7d25846684174048fbac258ae3ec08019c0b7 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build solaris
 // +build solaris
 
 // Package lif provides basic functions for the manipulation of
index 913a53e1185fc2b34c83009473fa958e9364de80..f1af1306ca3882ce0298b45ee8ec5cf92a83f4b3 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build solaris
 // +build solaris
 
 package lif
index c896041b7b457828b6cd080e05a8c8e654344ffe..d0b532d9dc95e0d2ccc82f7c825cbed05d7e9642 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build solaris
 // +build solaris
 
 package lif
index aadab2e14bae4bbc690c440e3457a885caeb5433..8d03b4aa92895e54a330fba79468e8694eae31e0 100644 (file)
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build solaris
 // +build solaris
 
 package lif
index 97166dd3c4c52ee5c37424ad0a7a3d883d5e095e..68d37c9621cba76eb64a299a18e0e6ff585cdd41 100644 (file)
@@ -2,28 +2,12 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build dragonfly || freebsd || netbsd || openbsd
-// +build dragonfly freebsd netbsd openbsd
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
+// +build darwin dragonfly freebsd netbsd openbsd
 
 package route
 
-import (
-       "syscall"
-       "unsafe"
-)
+import _ "unsafe" // for linkname
 
-var zero uintptr
-
-func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
-       var p unsafe.Pointer
-       if len(mib) > 0 {
-               p = unsafe.Pointer(&mib[0])
-       } else {
-               p = unsafe.Pointer(&zero)
-       }
-       _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), newlen)
-       if errno != 0 {
-               return error(errno)
-       }
-       return nil
-}
+//go:linkname sysctl syscall.sysctl
+func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error
diff --git a/src/vendor/golang.org/x/net/route/syscall_go1_12_darwin.go b/src/vendor/golang.org/x/net/route/syscall_go1_12_darwin.go
deleted file mode 100644 (file)
index 7a13e4f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.12
-// +build go1.12
-
-package route
-
-import _ "unsafe" // for linkname
-
-//go:linkname sysctl syscall.sysctl
-func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error
index 004b599288f63bb1a5ddc36aecb5bdf91c7e8ebb..265080668323faa45dead5063dea608d08bf1217 100644 (file)
@@ -9,7 +9,7 @@ golang.org/x/crypto/curve25519/internal/field
 golang.org/x/crypto/hkdf
 golang.org/x/crypto/internal/poly1305
 golang.org/x/crypto/internal/subtle
-# golang.org/x/net v0.0.0-20211108170745-6635138e15ea
+# golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9
 ## explicit; go 1.17
 golang.org/x/net/dns/dnsmessage
 golang.org/x/net/http/httpguts