mirror of
https://github.com/containers/skopeo.git
synced 2025-06-28 07:37:41 +00:00
Merge pull request #2129 from containers/renovate/go-golang.org/x/net-vulnerability
chore(deps): update module golang.org/x/net to v0.17.0 [security]
This commit is contained in:
commit
c375a1e37e
4
go.mod
4
go.mod
@ -117,9 +117,9 @@ require (
|
|||||||
go.opentelemetry.io/otel v1.16.0 // indirect
|
go.opentelemetry.io/otel v1.16.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.16.0 // indirect
|
go.opentelemetry.io/otel/metric v1.16.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.16.0 // indirect
|
go.opentelemetry.io/otel/trace v1.16.0 // indirect
|
||||||
golang.org/x/crypto v0.13.0 // indirect
|
golang.org/x/crypto v0.14.0 // indirect
|
||||||
golang.org/x/mod v0.12.0 // indirect
|
golang.org/x/mod v0.12.0 // indirect
|
||||||
golang.org/x/net v0.15.0 // indirect
|
golang.org/x/net v0.17.0 // indirect
|
||||||
golang.org/x/oauth2 v0.12.0 // indirect
|
golang.org/x/oauth2 v0.12.0 // indirect
|
||||||
golang.org/x/sync v0.3.0 // indirect
|
golang.org/x/sync v0.3.0 // indirect
|
||||||
golang.org/x/sys v0.13.0 // indirect
|
golang.org/x/sys v0.13.0 // indirect
|
||||||
|
8
go.sum
8
go.sum
@ -417,8 +417,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
|
|||||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
|
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||||
@ -441,8 +441,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
|||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
|
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4=
|
golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4=
|
||||||
golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4=
|
golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4=
|
||||||
|
14
vendor/golang.org/x/crypto/sha3/sha3.go
generated
vendored
14
vendor/golang.org/x/crypto/sha3/sha3.go
generated
vendored
@ -121,11 +121,11 @@ func (d *state) padAndPermute(dsbyte byte) {
|
|||||||
copyOut(d, d.buf)
|
copyOut(d, d.buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write absorbs more data into the hash's state. It produces an error
|
// Write absorbs more data into the hash's state. It panics if any
|
||||||
// if more data is written to the ShakeHash after writing
|
// output has already been read.
|
||||||
func (d *state) Write(p []byte) (written int, err error) {
|
func (d *state) Write(p []byte) (written int, err error) {
|
||||||
if d.state != spongeAbsorbing {
|
if d.state != spongeAbsorbing {
|
||||||
panic("sha3: write to sponge after read")
|
panic("sha3: Write after Read")
|
||||||
}
|
}
|
||||||
if d.buf == nil {
|
if d.buf == nil {
|
||||||
d.buf = d.storage.asBytes()[:0]
|
d.buf = d.storage.asBytes()[:0]
|
||||||
@ -182,12 +182,16 @@ func (d *state) Read(out []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sum applies padding to the hash state and then squeezes out the desired
|
// Sum applies padding to the hash state and then squeezes out the desired
|
||||||
// number of output bytes.
|
// number of output bytes. It panics if any output has already been read.
|
||||||
func (d *state) Sum(in []byte) []byte {
|
func (d *state) Sum(in []byte) []byte {
|
||||||
|
if d.state != spongeAbsorbing {
|
||||||
|
panic("sha3: Sum after Read")
|
||||||
|
}
|
||||||
|
|
||||||
// Make a copy of the original hash so that caller can keep writing
|
// Make a copy of the original hash so that caller can keep writing
|
||||||
// and summing.
|
// and summing.
|
||||||
dup := d.clone()
|
dup := d.clone()
|
||||||
hash := make([]byte, dup.outputLen)
|
hash := make([]byte, dup.outputLen, 64) // explicit cap to allow stack allocation
|
||||||
dup.Read(hash)
|
dup.Read(hash)
|
||||||
return append(in, hash...)
|
return append(in, hash...)
|
||||||
}
|
}
|
||||||
|
10
vendor/golang.org/x/crypto/sha3/sha3_s390x.go
generated
vendored
10
vendor/golang.org/x/crypto/sha3/sha3_s390x.go
generated
vendored
@ -49,7 +49,7 @@ type asmState struct {
|
|||||||
buf []byte // care must be taken to ensure cap(buf) is a multiple of rate
|
buf []byte // care must be taken to ensure cap(buf) is a multiple of rate
|
||||||
rate int // equivalent to block size
|
rate int // equivalent to block size
|
||||||
storage [3072]byte // underlying storage for buf
|
storage [3072]byte // underlying storage for buf
|
||||||
outputLen int // output length if fixed, 0 if not
|
outputLen int // output length for full security
|
||||||
function code // KIMD/KLMD function code
|
function code // KIMD/KLMD function code
|
||||||
state spongeDirection // whether the sponge is absorbing or squeezing
|
state spongeDirection // whether the sponge is absorbing or squeezing
|
||||||
}
|
}
|
||||||
@ -72,8 +72,10 @@ func newAsmState(function code) *asmState {
|
|||||||
s.outputLen = 64
|
s.outputLen = 64
|
||||||
case shake_128:
|
case shake_128:
|
||||||
s.rate = 168
|
s.rate = 168
|
||||||
|
s.outputLen = 32
|
||||||
case shake_256:
|
case shake_256:
|
||||||
s.rate = 136
|
s.rate = 136
|
||||||
|
s.outputLen = 64
|
||||||
default:
|
default:
|
||||||
panic("sha3: unrecognized function code")
|
panic("sha3: unrecognized function code")
|
||||||
}
|
}
|
||||||
@ -108,7 +110,7 @@ func (s *asmState) resetBuf() {
|
|||||||
// It never returns an error.
|
// It never returns an error.
|
||||||
func (s *asmState) Write(b []byte) (int, error) {
|
func (s *asmState) Write(b []byte) (int, error) {
|
||||||
if s.state != spongeAbsorbing {
|
if s.state != spongeAbsorbing {
|
||||||
panic("sha3: write to sponge after read")
|
panic("sha3: Write after Read")
|
||||||
}
|
}
|
||||||
length := len(b)
|
length := len(b)
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
@ -192,8 +194,8 @@ func (s *asmState) Read(out []byte) (n int, err error) {
|
|||||||
// Sum appends the current hash to b and returns the resulting slice.
|
// Sum appends the current hash to b and returns the resulting slice.
|
||||||
// It does not change the underlying hash state.
|
// It does not change the underlying hash state.
|
||||||
func (s *asmState) Sum(b []byte) []byte {
|
func (s *asmState) Sum(b []byte) []byte {
|
||||||
if s.outputLen == 0 {
|
if s.state != spongeAbsorbing {
|
||||||
panic("sha3: cannot call Sum on SHAKE functions")
|
panic("sha3: Sum after Read")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the state to preserve the original.
|
// Copy the state to preserve the original.
|
||||||
|
29
vendor/golang.org/x/crypto/sha3/shake.go
generated
vendored
29
vendor/golang.org/x/crypto/sha3/shake.go
generated
vendored
@ -17,26 +17,25 @@ package sha3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"hash"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ShakeHash defines the interface to hash functions that
|
// ShakeHash defines the interface to hash functions that support
|
||||||
// support arbitrary-length output.
|
// arbitrary-length output. When used as a plain [hash.Hash], it
|
||||||
|
// produces minimum-length outputs that provide full-strength generic
|
||||||
|
// security.
|
||||||
type ShakeHash interface {
|
type ShakeHash interface {
|
||||||
// Write absorbs more data into the hash's state. It panics if input is
|
hash.Hash
|
||||||
// written to it after output has been read from it.
|
|
||||||
io.Writer
|
|
||||||
|
|
||||||
// Read reads more output from the hash; reading affects the hash's
|
// Read reads more output from the hash; reading affects the hash's
|
||||||
// state. (ShakeHash.Read is thus very different from Hash.Sum)
|
// state. (ShakeHash.Read is thus very different from Hash.Sum)
|
||||||
// It never returns an error.
|
// It never returns an error, but subsequent calls to Write or Sum
|
||||||
|
// will panic.
|
||||||
io.Reader
|
io.Reader
|
||||||
|
|
||||||
// Clone returns a copy of the ShakeHash in its current state.
|
// Clone returns a copy of the ShakeHash in its current state.
|
||||||
Clone() ShakeHash
|
Clone() ShakeHash
|
||||||
|
|
||||||
// Reset resets the ShakeHash to its initial state.
|
|
||||||
Reset()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cSHAKE specific context
|
// cSHAKE specific context
|
||||||
@ -81,8 +80,8 @@ func leftEncode(value uint64) []byte {
|
|||||||
return b[i-1:]
|
return b[i-1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCShake(N, S []byte, rate int, dsbyte byte) ShakeHash {
|
func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) ShakeHash {
|
||||||
c := cshakeState{state: &state{rate: rate, dsbyte: dsbyte}}
|
c := cshakeState{state: &state{rate: rate, outputLen: outputLen, dsbyte: dsbyte}}
|
||||||
|
|
||||||
// leftEncode returns max 9 bytes
|
// leftEncode returns max 9 bytes
|
||||||
c.initBlock = make([]byte, 0, 9*2+len(N)+len(S))
|
c.initBlock = make([]byte, 0, 9*2+len(N)+len(S))
|
||||||
@ -119,7 +118,7 @@ func NewShake128() ShakeHash {
|
|||||||
if h := newShake128Asm(); h != nil {
|
if h := newShake128Asm(); h != nil {
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
return &state{rate: rate128, dsbyte: dsbyteShake}
|
return &state{rate: rate128, outputLen: 32, dsbyte: dsbyteShake}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewShake256 creates a new SHAKE256 variable-output-length ShakeHash.
|
// NewShake256 creates a new SHAKE256 variable-output-length ShakeHash.
|
||||||
@ -129,7 +128,7 @@ func NewShake256() ShakeHash {
|
|||||||
if h := newShake256Asm(); h != nil {
|
if h := newShake256Asm(); h != nil {
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
return &state{rate: rate256, dsbyte: dsbyteShake}
|
return &state{rate: rate256, outputLen: 64, dsbyte: dsbyteShake}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash,
|
// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash,
|
||||||
@ -142,7 +141,7 @@ func NewCShake128(N, S []byte) ShakeHash {
|
|||||||
if len(N) == 0 && len(S) == 0 {
|
if len(N) == 0 && len(S) == 0 {
|
||||||
return NewShake128()
|
return NewShake128()
|
||||||
}
|
}
|
||||||
return newCShake(N, S, rate128, dsbyteCShake)
|
return newCShake(N, S, rate128, 32, dsbyteCShake)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash,
|
// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash,
|
||||||
@ -155,7 +154,7 @@ func NewCShake256(N, S []byte) ShakeHash {
|
|||||||
if len(N) == 0 && len(S) == 0 {
|
if len(N) == 0 && len(S) == 0 {
|
||||||
return NewShake256()
|
return NewShake256()
|
||||||
}
|
}
|
||||||
return newCShake(N, S, rate256, dsbyteCShake)
|
return newCShake(N, S, rate256, 64, dsbyteCShake)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShakeSum128 writes an arbitrary-length digest of data into hash.
|
// ShakeSum128 writes an arbitrary-length digest of data into hash.
|
||||||
|
70
vendor/golang.org/x/net/http2/server.go
generated
vendored
70
vendor/golang.org/x/net/http2/server.go
generated
vendored
@ -581,9 +581,11 @@ type serverConn struct {
|
|||||||
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
|
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
|
||||||
curClientStreams uint32 // number of open streams initiated by the client
|
curClientStreams uint32 // number of open streams initiated by the client
|
||||||
curPushedStreams uint32 // number of open streams initiated by server push
|
curPushedStreams uint32 // number of open streams initiated by server push
|
||||||
|
curHandlers uint32 // number of running handler goroutines
|
||||||
maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests
|
maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests
|
||||||
maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes
|
maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes
|
||||||
streams map[uint32]*stream
|
streams map[uint32]*stream
|
||||||
|
unstartedHandlers []unstartedHandler
|
||||||
initialStreamSendWindowSize int32
|
initialStreamSendWindowSize int32
|
||||||
maxFrameSize int32
|
maxFrameSize int32
|
||||||
peerMaxHeaderListSize uint32 // zero means unknown (default)
|
peerMaxHeaderListSize uint32 // zero means unknown (default)
|
||||||
@ -981,6 +983,8 @@ func (sc *serverConn) serve() {
|
|||||||
return
|
return
|
||||||
case gracefulShutdownMsg:
|
case gracefulShutdownMsg:
|
||||||
sc.startGracefulShutdownInternal()
|
sc.startGracefulShutdownInternal()
|
||||||
|
case handlerDoneMsg:
|
||||||
|
sc.handlerDone()
|
||||||
default:
|
default:
|
||||||
panic("unknown timer")
|
panic("unknown timer")
|
||||||
}
|
}
|
||||||
@ -1020,6 +1024,7 @@ var (
|
|||||||
idleTimerMsg = new(serverMessage)
|
idleTimerMsg = new(serverMessage)
|
||||||
shutdownTimerMsg = new(serverMessage)
|
shutdownTimerMsg = new(serverMessage)
|
||||||
gracefulShutdownMsg = new(serverMessage)
|
gracefulShutdownMsg = new(serverMessage)
|
||||||
|
handlerDoneMsg = new(serverMessage)
|
||||||
)
|
)
|
||||||
|
|
||||||
func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) }
|
func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) }
|
||||||
@ -1892,10 +1897,12 @@ func (st *stream) copyTrailersToHandlerRequest() {
|
|||||||
// onReadTimeout is run on its own goroutine (from time.AfterFunc)
|
// onReadTimeout is run on its own goroutine (from time.AfterFunc)
|
||||||
// when the stream's ReadTimeout has fired.
|
// when the stream's ReadTimeout has fired.
|
||||||
func (st *stream) onReadTimeout() {
|
func (st *stream) onReadTimeout() {
|
||||||
|
if st.body != nil {
|
||||||
// Wrap the ErrDeadlineExceeded to avoid callers depending on us
|
// Wrap the ErrDeadlineExceeded to avoid callers depending on us
|
||||||
// returning the bare error.
|
// returning the bare error.
|
||||||
st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded))
|
st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
|
// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
|
||||||
// when the stream's WriteTimeout has fired.
|
// when the stream's WriteTimeout has fired.
|
||||||
@ -2012,13 +2019,10 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
|
|||||||
// (in Go 1.8), though. That's a more sane option anyway.
|
// (in Go 1.8), though. That's a more sane option anyway.
|
||||||
if sc.hs.ReadTimeout != 0 {
|
if sc.hs.ReadTimeout != 0 {
|
||||||
sc.conn.SetReadDeadline(time.Time{})
|
sc.conn.SetReadDeadline(time.Time{})
|
||||||
if st.body != nil {
|
|
||||||
st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
|
st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
go sc.runHandler(rw, req, handler)
|
return sc.scheduleHandler(id, rw, req, handler)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sc *serverConn) upgradeRequest(req *http.Request) {
|
func (sc *serverConn) upgradeRequest(req *http.Request) {
|
||||||
@ -2038,6 +2042,10 @@ func (sc *serverConn) upgradeRequest(req *http.Request) {
|
|||||||
sc.conn.SetReadDeadline(time.Time{})
|
sc.conn.SetReadDeadline(time.Time{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is the first request on the connection,
|
||||||
|
// so start the handler directly rather than going
|
||||||
|
// through scheduleHandler.
|
||||||
|
sc.curHandlers++
|
||||||
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
|
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2278,8 +2286,62 @@ func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *response
|
|||||||
return &responseWriter{rws: rws}
|
return &responseWriter{rws: rws}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type unstartedHandler struct {
|
||||||
|
streamID uint32
|
||||||
|
rw *responseWriter
|
||||||
|
req *http.Request
|
||||||
|
handler func(http.ResponseWriter, *http.Request)
|
||||||
|
}
|
||||||
|
|
||||||
|
// scheduleHandler starts a handler goroutine,
|
||||||
|
// or schedules one to start as soon as an existing handler finishes.
|
||||||
|
func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error {
|
||||||
|
sc.serveG.check()
|
||||||
|
maxHandlers := sc.advMaxStreams
|
||||||
|
if sc.curHandlers < maxHandlers {
|
||||||
|
sc.curHandlers++
|
||||||
|
go sc.runHandler(rw, req, handler)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if len(sc.unstartedHandlers) > int(4*sc.advMaxStreams) {
|
||||||
|
return sc.countError("too_many_early_resets", ConnectionError(ErrCodeEnhanceYourCalm))
|
||||||
|
}
|
||||||
|
sc.unstartedHandlers = append(sc.unstartedHandlers, unstartedHandler{
|
||||||
|
streamID: streamID,
|
||||||
|
rw: rw,
|
||||||
|
req: req,
|
||||||
|
handler: handler,
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sc *serverConn) handlerDone() {
|
||||||
|
sc.serveG.check()
|
||||||
|
sc.curHandlers--
|
||||||
|
i := 0
|
||||||
|
maxHandlers := sc.advMaxStreams
|
||||||
|
for ; i < len(sc.unstartedHandlers); i++ {
|
||||||
|
u := sc.unstartedHandlers[i]
|
||||||
|
if sc.streams[u.streamID] == nil {
|
||||||
|
// This stream was reset before its goroutine had a chance to start.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if sc.curHandlers >= maxHandlers {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
sc.curHandlers++
|
||||||
|
go sc.runHandler(u.rw, u.req, u.handler)
|
||||||
|
sc.unstartedHandlers[i] = unstartedHandler{} // don't retain references
|
||||||
|
}
|
||||||
|
sc.unstartedHandlers = sc.unstartedHandlers[i:]
|
||||||
|
if len(sc.unstartedHandlers) == 0 {
|
||||||
|
sc.unstartedHandlers = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Run on its own goroutine.
|
// Run on its own goroutine.
|
||||||
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
|
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
|
||||||
|
defer sc.sendServeMsg(handlerDoneMsg)
|
||||||
didPanic := true
|
didPanic := true
|
||||||
defer func() {
|
defer func() {
|
||||||
rw.rws.stream.cancelCtx()
|
rw.rws.stream.cancelCtx()
|
||||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -602,7 +602,7 @@ go.opentelemetry.io/otel/metric/embedded
|
|||||||
# go.opentelemetry.io/otel/trace v1.16.0
|
# go.opentelemetry.io/otel/trace v1.16.0
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
go.opentelemetry.io/otel/trace
|
go.opentelemetry.io/otel/trace
|
||||||
# golang.org/x/crypto v0.13.0
|
# golang.org/x/crypto v0.14.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/crypto/cast5
|
golang.org/x/crypto/cast5
|
||||||
golang.org/x/crypto/ed25519
|
golang.org/x/crypto/ed25519
|
||||||
@ -629,7 +629,7 @@ golang.org/x/exp/slices
|
|||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/mod/semver
|
golang.org/x/mod/semver
|
||||||
golang.org/x/mod/sumdb/note
|
golang.org/x/mod/sumdb/note
|
||||||
# golang.org/x/net v0.15.0
|
# golang.org/x/net v0.17.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/net/context
|
golang.org/x/net/context
|
||||||
golang.org/x/net/http/httpguts
|
golang.org/x/net/http/httpguts
|
||||||
|
Loading…
Reference in New Issue
Block a user