]> Cypherpunks repositories - gostls13.git/commit
net/http/httputil: allow ReverseProxy to call ModifyResponse on failed requests
authorAkhil Indurti <aindurti@gmail.com>
Tue, 14 Nov 2017 16:40:09 +0000 (11:40 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 14 Nov 2017 17:28:37 +0000 (17:28 +0000)
commit5ea2360b6643ec53018b1c080f4824b8238bff3a
tree19ef4b37dd1cc7ab06e456863dbaf290b4eadaaf
parent0d9dc044d2008867e457a2023875501e1e986e6d
net/http/httputil: allow ReverseProxy to call ModifyResponse on failed requests

Previously when RoundTrip returned a non-nil error, the proxy returned a
StatusBadGateway error, instead of first calling ModifyResponse. This
commit first calls ModifyResponse, whether or not the error returned
from RoundTrip is nil.

Also closes response body when ModifyResponse returns an error. See #22658.

Fixes #21255

Change-Id: I5b5bf23a69ae5608f87d4ece756a1b4985ccaa9c
Reviewed-on: https://go-review.googlesource.com/54030
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/httputil/reverseproxy.go
src/net/http/httputil/reverseproxy_test.go