]> Cypherpunks repositories - gostls13.git/commit
net/http/httputil: avoid ReverseProxy data race on 1xx response and error
authorDamien Neil <dneil@google.com>
Mon, 26 Feb 2024 21:45:42 +0000 (13:45 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 27 Feb 2024 23:37:42 +0000 (23:37 +0000)
commit960654be0c4ad7918376e2e1d47491c9bc7520e0
treefe310c9b14bd707f1665e84b507042fd04823492
parentd3e827d371ac2e6bb68c81d992f99ccd4b1b2cf1
net/http/httputil: avoid ReverseProxy data race on 1xx response and error

ReverseProxy uses a httptrace.ClientTrace.Got1xxResponse trace hook
to capture 1xx response headers for proxying. This hook can be called
asynchrnously after RoundTrip returns. (This should only happen when
RoundTrip has failed for some reason.) Add synchronization so we don't
attempt to modifying the ResponseWriter headers map from the hook
after another goroutine has begun making use of it.

Fixes #65123

Change-Id: I8b7ecb1a140f7ba7e37b9d27b8a20bca41a118b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/567216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
src/net/http/httputil/reverseproxy.go
src/net/http/httputil/reverseproxy_test.go