From 6beb52b1c5c364a69d930ef8018bb2f3f4339c30 Mon Sep 17 00:00:00 2001 From: Kyle Xiao Date: Tue, 19 Nov 2024 20:50:32 +0800 Subject: [PATCH] fix(http1): use bytes.EqualFold for header value check --- 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)