mirror of
https://github.com/golang/go.git
synced 2026-04-04 10:20:00 +09:00
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>
This commit is contained in:
committed by
Gopher Robot
parent
afef73a5aa
commit
29ada7aa48
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user