mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-09-11 15:52:30 +00:00
Update dependencies (#1929)
This commit is contained in:
11
vendor/golang.org/x/net/http2/h2c/h2c.go
generated
vendored
11
vendor/golang.org/x/net/http2/h2c/h2c.go
generated
vendored
@@ -70,6 +70,15 @@ func NewHandler(h http.Handler, s *http2.Server) http.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
// extractServer extracts existing http.Server instance from http.Request or create an empty http.Server
|
||||
func extractServer(r *http.Request) *http.Server {
|
||||
server, ok := r.Context().Value(http.ServerContextKey).(*http.Server)
|
||||
if ok {
|
||||
return server
|
||||
}
|
||||
return new(http.Server)
|
||||
}
|
||||
|
||||
// ServeHTTP implement the h2c support that is enabled by h2c.GetH2CHandler.
|
||||
func (s h2cHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// Handle h2c with prior knowledge (RFC 7540 Section 3.4)
|
||||
@@ -87,6 +96,7 @@ func (s h2cHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
defer conn.Close()
|
||||
s.s.ServeConn(conn, &http2.ServeConnOpts{
|
||||
Context: r.Context(),
|
||||
BaseConfig: extractServer(r),
|
||||
Handler: s.Handler,
|
||||
SawClientPreface: true,
|
||||
})
|
||||
@@ -104,6 +114,7 @@ func (s h2cHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
defer conn.Close()
|
||||
s.s.ServeConn(conn, &http2.ServeConnOpts{
|
||||
Context: r.Context(),
|
||||
BaseConfig: extractServer(r),
|
||||
Handler: s.Handler,
|
||||
UpgradeRequest: r,
|
||||
Settings: settings,
|
||||
|
Reference in New Issue
Block a user