From 7a6a7e7ee12768cea7a86eca80bc8c40cc469e98 Mon Sep 17 00:00:00 2001 From: Skyenought Date: Fri, 2 Feb 2024 11:29:40 +0800 Subject: [PATCH] tmp --- pkg/protocol/args.go | 12 ++++++------ pkg/protocol/http1/server.go | 6 +++--- pkg/protocol/request.go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) 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() {