update the golang compiler version and the versions of several dependencies
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
This commit is contained in:
parent
84f47e7bb3
commit
afe29bb697
209 changed files with 31657 additions and 7738 deletions
44
vendor/golang.org/x/net/http2/server.go
generated
vendored
44
vendor/golang.org/x/net/http2/server.go
generated
vendored
|
@ -273,7 +273,20 @@ func ConfigureServer(s *http.Server, conf *Server) error {
|
|||
if testHookOnConn != nil {
|
||||
testHookOnConn()
|
||||
}
|
||||
// The TLSNextProto interface predates contexts, so
|
||||
// the net/http package passes down its per-connection
|
||||
// base context via an exported but unadvertised
|
||||
// method on the Handler. This is for internal
|
||||
// net/http<=>http2 use only.
|
||||
var ctx context.Context
|
||||
type baseContexter interface {
|
||||
BaseContext() context.Context
|
||||
}
|
||||
if bc, ok := h.(baseContexter); ok {
|
||||
ctx = bc.BaseContext()
|
||||
}
|
||||
conf.ServeConn(c, &ServeConnOpts{
|
||||
Context: ctx,
|
||||
Handler: h,
|
||||
BaseConfig: hs,
|
||||
})
|
||||
|
@ -284,6 +297,10 @@ func ConfigureServer(s *http.Server, conf *Server) error {
|
|||
|
||||
// ServeConnOpts are options for the Server.ServeConn method.
|
||||
type ServeConnOpts struct {
|
||||
// Context is the base context to use.
|
||||
// If nil, context.Background is used.
|
||||
Context context.Context
|
||||
|
||||
// BaseConfig optionally sets the base configuration
|
||||
// for values. If nil, defaults are used.
|
||||
BaseConfig *http.Server
|
||||
|
@ -294,6 +311,13 @@ type ServeConnOpts struct {
|
|||
Handler http.Handler
|
||||
}
|
||||
|
||||
func (o *ServeConnOpts) context() context.Context {
|
||||
if o.Context != nil {
|
||||
return o.Context
|
||||
}
|
||||
return context.Background()
|
||||
}
|
||||
|
||||
func (o *ServeConnOpts) baseConfig() *http.Server {
|
||||
if o != nil && o.BaseConfig != nil {
|
||||
return o.BaseConfig
|
||||
|
@ -439,7 +463,7 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
|
|||
}
|
||||
|
||||
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx context.Context, cancel func()) {
|
||||
ctx, cancel = context.WithCancel(context.Background())
|
||||
ctx, cancel = context.WithCancel(opts.context())
|
||||
ctx = context.WithValue(ctx, http.LocalAddrContextKey, c.LocalAddr())
|
||||
if hs := opts.baseConfig(); hs != nil {
|
||||
ctx = context.WithValue(ctx, http.ServerContextKey, hs)
|
||||
|
@ -2307,7 +2331,16 @@ type chunkWriter struct{ rws *responseWriterState }
|
|||
|
||||
func (cw chunkWriter) Write(p []byte) (n int, err error) { return cw.rws.writeChunk(p) }
|
||||
|
||||
func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) != 0 }
|
||||
func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) > 0 }
|
||||
|
||||
func (rws *responseWriterState) hasNonemptyTrailers() bool {
|
||||
for _, trailer := range rws.trailers {
|
||||
if _, ok := rws.handlerHeader[trailer]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// declareTrailer is called for each Trailer header when the
|
||||
// response header is written. It notes that a header will need to be
|
||||
|
@ -2407,7 +2440,10 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
|||
rws.promoteUndeclaredTrailers()
|
||||
}
|
||||
|
||||
endStream := rws.handlerDone && !rws.hasTrailers()
|
||||
// only send trailers if they have actually been defined by the
|
||||
// server handler.
|
||||
hasNonemptyTrailers := rws.hasNonemptyTrailers()
|
||||
endStream := rws.handlerDone && !hasNonemptyTrailers
|
||||
if len(p) > 0 || endStream {
|
||||
// only send a 0 byte DATA frame if we're ending the stream.
|
||||
if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil {
|
||||
|
@ -2416,7 +2452,7 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if rws.handlerDone && rws.hasTrailers() {
|
||||
if rws.handlerDone && hasNonemptyTrailers {
|
||||
err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{
|
||||
streamID: rws.stream.id,
|
||||
h: rws.handlerHeader,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue