From e64f7ef03fdfa1c0d847c21b16c9302cc824e79b Mon Sep 17 00:00:00 2001 From: Sean Liao Date: Wed, 13 Nov 2024 18:54:54 +0000 Subject: [PATCH] net/http/httputil: return after handling error Fixes #70237 Change-Id: Ieb22b6e7284cb4a40d4987b0e4b9cfb6e5158161 Reviewed-on: https://go-review.googlesource.com/c/go/+/627635 LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov Reviewed-by: Damien Neil --- src/net/http/httputil/reverseproxy.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index 04248d5f53..d64d2fc3a1 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -739,6 +739,7 @@ func (p *ReverseProxy) handleUpgradeResponse(rw http.ResponseWriter, req *http.R resUpType := upgradeType(res.Header) if !ascii.IsPrint(resUpType) { // We know reqUpType is ASCII, it's checked by the caller. p.getErrorHandler()(rw, req, fmt.Errorf("backend tried to switch to invalid protocol %q", resUpType)) + return } if !ascii.EqualFold(reqUpType, resUpType) { p.getErrorHandler()(rw, req, fmt.Errorf("backend tried to switch protocol %q when %q was requested", resUpType, reqUpType)) -- 2.48.1