Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyenought committed Feb 2, 2024
1 parent 1341d81 commit 7a6a7e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pkg/protocol/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions pkg/protocol/http1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/protocol/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 7a6a7e7

Please sign in to comment.