mirror of
https://github.com/containers/skopeo.git
synced 2025-09-18 16:08:59 +00:00
Update github.com/containerd/containerd
$ go get -u github.ccom/containerd/containerd $ make vendor ... to silence warnings about https://github.com/advisories/GHSA-crp2-qrr5-8pq7 , in code we don't use. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
17
vendor/golang.org/x/net/http2/go118.go
generated
vendored
Normal file
17
vendor/golang.org/x/net/http2/go118.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2021 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.18
|
||||
// +build go1.18
|
||||
|
||||
package http2
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
)
|
||||
|
||||
func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
|
||||
return tc.NetConn()
|
||||
}
|
17
vendor/golang.org/x/net/http2/not_go118.go
generated
vendored
Normal file
17
vendor/golang.org/x/net/http2/not_go118.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2021 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.18
|
||||
// +build !go1.18
|
||||
|
||||
package http2
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
)
|
||||
|
||||
func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
|
||||
return nil
|
||||
}
|
10
vendor/golang.org/x/net/http2/server.go
generated
vendored
10
vendor/golang.org/x/net/http2/server.go
generated
vendored
@@ -719,7 +719,15 @@ func (sc *serverConn) canonicalHeader(v string) string {
|
||||
sc.canonHeader = make(map[string]string)
|
||||
}
|
||||
cv = http.CanonicalHeaderKey(v)
|
||||
sc.canonHeader[v] = cv
|
||||
// maxCachedCanonicalHeaders is an arbitrarily-chosen limit on the number of
|
||||
// entries in the canonHeader cache. This should be larger than the number
|
||||
// of unique, uncommon header keys likely to be sent by the peer, while not
|
||||
// so high as to permit unreasonable memory usage if the peer sends an unbounded
|
||||
// number of unique header keys.
|
||||
const maxCachedCanonicalHeaders = 32
|
||||
if len(sc.canonHeader) < maxCachedCanonicalHeaders {
|
||||
sc.canonHeader[v] = cv
|
||||
}
|
||||
return cv
|
||||
}
|
||||
|
||||
|
119
vendor/golang.org/x/net/http2/transport.go
generated
vendored
119
vendor/golang.org/x/net/http2/transport.go
generated
vendored
@@ -735,7 +735,6 @@ func (cc *ClientConn) healthCheck() {
|
||||
err := cc.Ping(ctx)
|
||||
if err != nil {
|
||||
cc.closeForLostPing()
|
||||
cc.t.connPool().MarkDead(cc)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -907,6 +906,24 @@ func (cc *ClientConn) onIdleTimeout() {
|
||||
cc.closeIfIdle()
|
||||
}
|
||||
|
||||
func (cc *ClientConn) closeConn() error {
|
||||
t := time.AfterFunc(250*time.Millisecond, cc.forceCloseConn)
|
||||
defer t.Stop()
|
||||
return cc.tconn.Close()
|
||||
}
|
||||
|
||||
// A tls.Conn.Close can hang for a long time if the peer is unresponsive.
|
||||
// Try to shut it down more aggressively.
|
||||
func (cc *ClientConn) forceCloseConn() {
|
||||
tc, ok := cc.tconn.(*tls.Conn)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if nc := tlsUnderlyingConn(tc); nc != nil {
|
||||
nc.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func (cc *ClientConn) closeIfIdle() {
|
||||
cc.mu.Lock()
|
||||
if len(cc.streams) > 0 || cc.streamsReserved > 0 {
|
||||
@@ -921,7 +938,7 @@ func (cc *ClientConn) closeIfIdle() {
|
||||
if VerboseLogs {
|
||||
cc.vlogf("http2: Transport closing idle conn %p (forSingleUse=%v, maxStream=%v)", cc, cc.singleUse, nextID-2)
|
||||
}
|
||||
cc.tconn.Close()
|
||||
cc.closeConn()
|
||||
}
|
||||
|
||||
func (cc *ClientConn) isDoNotReuseAndIdle() bool {
|
||||
@@ -938,7 +955,7 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
// Wait for all in-flight streams to complete or connection to close
|
||||
done := make(chan error, 1)
|
||||
done := make(chan struct{})
|
||||
cancelled := false // guarded by cc.mu
|
||||
go func() {
|
||||
cc.mu.Lock()
|
||||
@@ -946,7 +963,7 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error {
|
||||
for {
|
||||
if len(cc.streams) == 0 || cc.closed {
|
||||
cc.closed = true
|
||||
done <- cc.tconn.Close()
|
||||
close(done)
|
||||
break
|
||||
}
|
||||
if cancelled {
|
||||
@@ -957,8 +974,8 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error {
|
||||
}()
|
||||
shutdownEnterWaitStateHook()
|
||||
select {
|
||||
case err := <-done:
|
||||
return err
|
||||
case <-done:
|
||||
return cc.closeConn()
|
||||
case <-ctx.Done():
|
||||
cc.mu.Lock()
|
||||
// Free the goroutine above
|
||||
@@ -1001,9 +1018,9 @@ func (cc *ClientConn) closeForError(err error) error {
|
||||
for _, cs := range cc.streams {
|
||||
cs.abortStreamLocked(err)
|
||||
}
|
||||
defer cc.cond.Broadcast()
|
||||
defer cc.mu.Unlock()
|
||||
return cc.tconn.Close()
|
||||
cc.cond.Broadcast()
|
||||
cc.mu.Unlock()
|
||||
return cc.closeConn()
|
||||
}
|
||||
|
||||
// Close closes the client connection immediately.
|
||||
@@ -1124,36 +1141,49 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
}
|
||||
}
|
||||
|
||||
handleResponseHeaders := func() (*http.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 == noBody && actualContentLength(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 == noBody && actualContentLength(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)
|
||||
@@ -1239,12 +1269,12 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
|
||||
}
|
||||
|
||||
continueTimeout := cc.t.expectContinueTimeout()
|
||||
if continueTimeout != 0 &&
|
||||
!httpguts.HeaderValuesContainsToken(
|
||||
req.Header["Expect"],
|
||||
"100-continue") {
|
||||
continueTimeout = 0
|
||||
cs.on100 = make(chan struct{}, 1)
|
||||
if continueTimeout != 0 {
|
||||
if !httpguts.HeaderValuesContainsToken(req.Header["Expect"], "100-continue") {
|
||||
continueTimeout = 0
|
||||
} else {
|
||||
cs.on100 = make(chan struct{}, 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Past this point (where we send request headers), it is possible for
|
||||
@@ -1313,6 +1343,7 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
|
||||
case <-respHeaderTimer:
|
||||
return errTimeout
|
||||
case <-respHeaderRecv:
|
||||
respHeaderRecv = nil
|
||||
respHeaderTimer = nil // keep waiting for END_STREAM
|
||||
case <-cs.abort:
|
||||
return cs.abortErr
|
||||
@@ -1964,7 +1995,7 @@ func (cc *ClientConn) forgetStreamID(id uint32) {
|
||||
cc.vlogf("http2: Transport closing idle conn %p (forSingleUse=%v, maxStream=%v)", cc, cc.singleUse, cc.nextStreamID-2)
|
||||
}
|
||||
cc.closed = true
|
||||
defer cc.tconn.Close()
|
||||
defer cc.closeConn()
|
||||
}
|
||||
|
||||
cc.mu.Unlock()
|
||||
@@ -2011,8 +2042,8 @@ func isEOFOrNetReadError(err error) bool {
|
||||
|
||||
func (rl *clientConnReadLoop) cleanup() {
|
||||
cc := rl.cc
|
||||
defer cc.tconn.Close()
|
||||
defer cc.t.connPool().MarkDead(cc)
|
||||
cc.t.connPool().MarkDead(cc)
|
||||
defer cc.closeConn()
|
||||
defer close(cc.readerDone)
|
||||
|
||||
if cc.idleTimer != nil {
|
||||
|
4
vendor/golang.org/x/net/http2/writesched.go
generated
vendored
4
vendor/golang.org/x/net/http2/writesched.go
generated
vendored
@@ -32,7 +32,8 @@ type WriteScheduler interface {
|
||||
|
||||
// Pop dequeues the next frame to write. Returns false if no frames can
|
||||
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
||||
// order they are Push'd. No frames should be discarded except by CloseStream.
|
||||
// order they are Push'd, except RST_STREAM frames. No frames should be
|
||||
// discarded except by CloseStream.
|
||||
Pop() (wr FrameWriteRequest, ok bool)
|
||||
}
|
||||
|
||||
@@ -52,6 +53,7 @@ type FrameWriteRequest struct {
|
||||
|
||||
// stream is the stream on which this frame will be written.
|
||||
// nil for non-stream frames like PING and SETTINGS.
|
||||
// nil for RST_STREAM streams, which use the StreamError.StreamID field instead.
|
||||
stream *stream
|
||||
|
||||
// done, if non-nil, must be a buffered channel with space for
|
||||
|
6
vendor/golang.org/x/net/http2/writesched_random.go
generated
vendored
6
vendor/golang.org/x/net/http2/writesched_random.go
generated
vendored
@@ -45,11 +45,11 @@ func (ws *randomWriteScheduler) AdjustStream(streamID uint32, priority PriorityP
|
||||
}
|
||||
|
||||
func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) {
|
||||
id := wr.StreamID()
|
||||
if id == 0 {
|
||||
if wr.isControl() {
|
||||
ws.zero.push(wr)
|
||||
return
|
||||
}
|
||||
id := wr.StreamID()
|
||||
q, ok := ws.sq[id]
|
||||
if !ok {
|
||||
q = ws.queuePool.get()
|
||||
@@ -59,7 +59,7 @@ func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) {
|
||||
}
|
||||
|
||||
func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) {
|
||||
// Control frames first.
|
||||
// Control and RST_STREAM frames first.
|
||||
if !ws.zero.empty() {
|
||||
return ws.zero.shift(), true
|
||||
}
|
||||
|
Reference in New Issue
Block a user