]> Cypherpunks repositories - gostls13.git/commit
net/http/httputil: fix regression in ReverseProxy.ServeHTTP
authorJoe Tsai <joetsai@digital-static.net>
Wed, 17 Jul 2019 00:40:20 +0000 (17:40 -0700)
committerJoe Tsai <thebrokentoaster@gmail.com>
Wed, 17 Jul 2019 21:52:45 +0000 (21:52 +0000)
commitf93234ad620cc34573bca56be9fcf55c975e0821
treef94d2806acf10ecf5a16ce853ce7b1c7677884ce
parent5bc46cb71215f445797fb55e2b4eee795ee1ca17
net/http/httputil: fix regression in ReverseProxy.ServeHTTP

In Go1.12 and below, the logic in ReverseProxy.ServeHTTP would always
allocate request.Header even if it were not present in the incoming request.
CL 174324 added http.Request.Clone and re-factors ReverseProxy.ServeHTTP
to use the new Clone method. However, the new Clone logic is not equivalent
to the former logic. We preserve former semantics by explicitly allocating
the Header map if nil.

Fixes #33142

Change-Id: I356f94a915dd9779584ce3fe31e56e5474b9ad37
Reviewed-on: https://go-review.googlesource.com/c/go/+/186437
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
src/net/http/httputil/reverseproxy.go
src/net/http/httputil/reverseproxy_test.go