diff options
| author | 2025-04-01 16:21:59 +0000 | |
|---|---|---|
| committer | 2025-04-01 18:21:59 +0200 | |
| commit | b0873972ecb6d9977a36898d8281649d38c17df7 (patch) | |
| tree | 1b0eb8a89c99058d443e6550e4dfa3ba347804a7 /vendor/golang.org/x/net/http2/h2c | |
| parent | update modernc.org/sqlite to v1.37.0-concurrrency-workaround (#3958) (diff) | |
| download | gotosocial-b0873972ecb6d9977a36898d8281649d38c17df7.tar.xz | |
[chore] bump golang.org/x/net@v0.38.0, github.com/gin-contrib/cors@v1.7.4, github.com/spf13/viper@v1.20.1, github.com/tdewolff/minify/v2@v2.22.4 (#3959)
Diffstat (limited to 'vendor/golang.org/x/net/http2/h2c')
| -rw-r--r-- | vendor/golang.org/x/net/http2/h2c/h2c.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/vendor/golang.org/x/net/http2/h2c/h2c.go b/vendor/golang.org/x/net/http2/h2c/h2c.go index 2d6bf861b..19e94791d 100644 --- a/vendor/golang.org/x/net/http2/h2c/h2c.go +++ b/vendor/golang.org/x/net/http2/h2c/h2c.go @@ -132,11 +132,8 @@ func (s h2cHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // of the body, and reforward the client preface on the net.Conn this function // creates. func initH2CWithPriorKnowledge(w http.ResponseWriter) (net.Conn, error) { - hijacker, ok := w.(http.Hijacker) - if !ok { - return nil, errors.New("h2c: connection does not support Hijack") - } - conn, rw, err := hijacker.Hijack() + rc := http.NewResponseController(w) + conn, rw, err := rc.Hijack() if err != nil { return nil, err } @@ -163,10 +160,6 @@ func h2cUpgrade(w http.ResponseWriter, r *http.Request) (_ net.Conn, settings [] if err != nil { return nil, nil, err } - hijacker, ok := w.(http.Hijacker) - if !ok { - return nil, nil, errors.New("h2c: connection does not support Hijack") - } body, err := io.ReadAll(r.Body) if err != nil { @@ -174,7 +167,8 @@ func h2cUpgrade(w http.ResponseWriter, r *http.Request) (_ net.Conn, settings [] } r.Body = io.NopCloser(bytes.NewBuffer(body)) - conn, rw, err := hijacker.Hijack() + rc := http.NewResponseController(w) + conn, rw, err := rc.Hijack() if err != nil { return nil, nil, err } |
