]> Cypherpunks repositories - gostls13.git/commitdiff
net/http/httputil: return after handling error
authorSean Liao <sean@liao.dev>
Wed, 13 Nov 2024 18:54:54 +0000 (18:54 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 18 Nov 2024 16:43:40 +0000 (16:43 +0000)
Fixes #70237

Change-Id: Ieb22b6e7284cb4a40d4987b0e4b9cfb6e5158161
Reviewed-on: https://go-review.googlesource.com/c/go/+/627635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/httputil/reverseproxy.go

index 04248d5f531e233c37056ecb3470c33ea4a10abb..d64d2fc3a18ee3f86b7775f3bfdd9913dddd9f26 100644 (file)
@@ -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))