From 74815dd773b3a2a4c2b71bf5065b039741756f6b Mon Sep 17 00:00:00 2001 From: Kyle Xiao Date: Tue, 19 Nov 2024 20:57:23 +0800 Subject: [PATCH] fix(http1): use bytes.EqualFold for header value check (#1232) --- pkg/protocol/http1/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/protocol/http1/client.go b/pkg/protocol/http1/client.go index 149029db0..758d1649d 100644 --- a/pkg/protocol/http1/client.go +++ b/pkg/protocol/http1/client.go @@ -701,7 +701,7 @@ func (c *HostClient) doNonNilReqResp(req *protocol.Request, resp *protocol.Respo shouldCloseConn = resetConnection || req.ConnectionClose() || resp.ConnectionClose() if resp.Header.StatusCode() == consts.StatusSwitchingProtocols && - bytes.Equal(resp.Header.Peek(consts.HeaderConnection), bytestr.StrUpgrade) { + bytes.EqualFold(resp.Header.Peek(consts.HeaderConnection), bytestr.StrUpgrade) { // can not reuse connection in this case, it's no longer http1 protocol. // set BodyStream for (*Response).Hijack resp.SetBodyStream(newUpgradeConn(c, cc), -1)