]> Cypherpunks repositories - gostls13.git/commit
net/http: tweak the new Client 307/308 redirect behavior a bit
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 3 Nov 2016 20:53:05 +0000 (20:53 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 4 Nov 2016 03:37:26 +0000 (03:37 +0000)
commit3440c7bc4c238e1d75d728536ca8f5efe883dbe6
tree7fb302a0156ee1ef0e5b6359f0477d2d78c79130
parent6e269256264599a49739ad1145bac3845e94ead4
net/http: tweak the new Client 307/308 redirect behavior a bit

This CL tweaks the new (unreleased) 307/308 support added in
https://golang.org/cl/29852 for #10767.

Change 1: if a 307/308 response doesn't have a Location header in its
response (as observed in the wild in #17773), just do what we used to
do in Go 1.7 and earlier, and don't try to follow that redirect.

Change 2: don't follow a 307/308 if we sent a body on the first
request and the caller's Request.GetBody func is nil so we can't
"rewind" the body to send it again.

Updates #17773 (will be fixed more elsewhere)

Change-Id: I183570f7346917828a4b6f7f1773094122a30406
Reviewed-on: https://go-review.googlesource.com/32595
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/client.go
src/net/http/client_test.go