aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2026-03-09 12:14:02 -0700
committerGopher Robot <gobot@golang.org>2026-03-12 08:10:38 -0700
commit29ada7aa481930fbddab626e0686f84c1fcd63a2 (patch)
treec9e8e72195e973a5a66ae8165b6eeb26bfcf0118 /src/net/http
parentafef73a5aacdb4f921ca5fddfb03b0a29998cbfe (diff)
downloadgo-29ada7aa481930fbddab626e0686f84c1fcd63a2.tar.xz
net/http/internal/http2: remove ServeConnOpts.UpgradeRequest
UpgradeRequest is used by the x/net/http2/h2c package for upgrading HTTP/1.1 requests to unencrypted HTTP/2. net/http only supports unencrypted HTTP/2 "with prior knowledge", not upgrade. Drop the field. For #67810 Change-Id: Iae48386e2e299dbf3b433954b87b6eb86a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/753320 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/internal/http2/server.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/net/http/internal/http2/server.go b/src/net/http/internal/http2/server.go
index 6457906158..98bec52343 100644
--- a/src/net/http/internal/http2/server.go
+++ b/src/net/http/internal/http2/server.go
@@ -362,12 +362,6 @@ type ServeConnOpts struct {
// or BaseConfig.Handler is nil, http.DefaultServeMux is used.
Handler http.Handler
- // UpgradeRequest is an initial request received on a connection
- // undergoing an h2c upgrade. The request body must have been
- // completely read from the connection before calling ServeConn,
- // and the 101 Switching Protocols response written.
- UpgradeRequest *http.Request
-
// Settings is the decoded contents of the HTTP2-Settings header
// in an h2c upgrade request.
Settings []byte
@@ -560,11 +554,6 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon
hook(sc)
}
- if opts.UpgradeRequest != nil {
- sc.upgradeRequest(opts.UpgradeRequest)
- opts.UpgradeRequest = nil
- }
-
sc.serve(conf)
}
@@ -2165,30 +2154,6 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
return sc.scheduleHandler(id, rw, req, handler)
}
-func (sc *serverConn) upgradeRequest(req *http.Request) {
- sc.serveG.check()
- id := uint32(1)
- sc.maxClientStreamID = id
- st := sc.newStream(id, 0, stateHalfClosedRemote, defaultRFC9218Priority(sc.priorityAware && !sc.hasIntermediary))
- st.reqTrailer = req.Trailer
- if st.reqTrailer != nil {
- st.trailer = make(http.Header)
- }
- rw := sc.newResponseWriter(st, req)
-
- // Disable any read deadline set by the net/http package
- // prior to the upgrade.
- if sc.hs.ReadTimeout > 0 {
- 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)
-}
-
func (st *stream) processTrailerHeaders(f *MetaHeadersFrame) error {
sc := st.sc
sc.serveG.check()