diff --git a/pkg/protocol/args.go b/pkg/protocol/args.go index c747f81f5..6d09c888f 100644 --- a/pkg/protocol/args.go +++ b/pkg/protocol/args.go @@ -63,13 +63,13 @@ type argsScanner struct { type Args struct { noCopy nocopy.NoCopy //lint:ignore U1000 until noCopy is used - args []argsKV - buf []byte - reuse bool + args []argsKV + buf []byte + disableReuse bool } -func (a *Args) SetReuseArgs(b bool) { - a.reuse = b +func (a *Args) SetDisableReuseArgs(b bool) { + a.disableReuse = b } // Set sets 'key=value' argument. @@ -79,7 +79,7 @@ func (a *Args) Set(key, value string) { // Reset clears query args. func (a *Args) Reset() { - if a.reuse { + if a.disableReuse { a.args = []argsKV{} } a.args = a.args[:0] diff --git a/pkg/protocol/http1/server.go b/pkg/protocol/http1/server.go index add27ad64..ea9490605 100644 --- a/pkg/protocol/http1/server.go +++ b/pkg/protocol/http1/server.go @@ -141,6 +141,9 @@ func (s Server) Serve(c context.Context, conn network.Conn) (err error) { ctx.HTMLRender = s.HTMLRender ctx.SetConn(conn) ctx.Request.SetIsTLS(s.TLS != nil) + ctx.Request.PostArgs().SetDisableReuseArgs(s.DisableReuseArgs) + ctx.Request.URI().QueryArgs().SetDisableReuseArgs(s.DisableReuseArgs) + ctx.SetEnableTrace(s.EnableTrace) if !s.NoDefaultServerHeader { @@ -192,9 +195,6 @@ func (s Server) Serve(c context.Context, conn network.Conn) (err error) { ctx.Response.Header.DisableNormalizing() } - ctx.Request.PostArgs().SetReuseArgs(s.DisableReuseArgs) - ctx.Request.URI().QueryArgs().SetReuseArgs(s.DisableReuseArgs) - // Read Headers if err = req.ReadHeader(&ctx.Request.Header, zr); err == nil { if s.EnableTrace { diff --git a/pkg/protocol/request.go b/pkg/protocol/request.go index d04731867..88e160305 100644 --- a/pkg/protocol/request.go +++ b/pkg/protocol/request.go @@ -181,7 +181,7 @@ func (req *Request) Scheme() []byte { return req.uri.Scheme() } -// For keepalive connection reuse. +// For keepalive connection disableReuse. // It is roughly the same as ResetSkipHeader, except that the connection related fields are removed: // - req.isTLS func (req *Request) resetSkipHeaderAndConn() {