diff options
Diffstat (limited to 'src/net/http/httputil')
| -rw-r--r-- | src/net/http/httputil/reverseproxy.go | 27 | ||||
| -rw-r--r-- | src/net/http/httputil/reverseproxy_test.go | 2 |
2 files changed, 2 insertions, 27 deletions
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index 190279ca00..ad0221ff33 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -816,34 +816,9 @@ func (c switchProtocolCopier) copyToBackend(errc chan<- error) { } func cleanQueryParams(s string) string { - reencode := func(s string) string { + if strings.Contains(s, ";") { v, _ := url.ParseQuery(s) return v.Encode() } - for i := 0; i < len(s); { - switch s[i] { - case ';': - return reencode(s) - case '%': - if i+2 >= len(s) || !ishex(s[i+1]) || !ishex(s[i+2]) { - return reencode(s) - } - i += 3 - default: - i++ - } - } return s } - -func ishex(c byte) bool { - switch { - case '0' <= c && c <= '9': - return true - case 'a' <= c && c <= 'f': - return true - case 'A' <= c && c <= 'F': - return true - } - return false -} diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go index 5b882d3a45..5a0237494c 100644 --- a/src/net/http/httputil/reverseproxy_test.go +++ b/src/net/http/httputil/reverseproxy_test.go @@ -1831,7 +1831,7 @@ func testReverseProxyQueryParameterSmuggling(t *testing.T, wantCleanQuery bool, cleanQuery: "a=1", }, { rawQuery: "a=1&a=%zz&b=3", - cleanQuery: "a=1&b=3", + cleanQuery: "a=1&a=%zz&b=3", }} { res, err := frontend.Client().Get(frontend.URL + "?" + test.rawQuery) if err != nil { |
