]> Cypherpunks repositories - gostls13.git/commit
net/http: 308 redirects should use the previous hop's body
authorDamien Neil <dneil@google.com>
Wed, 6 Nov 2024 19:08:51 +0000 (11:08 -0800)
committerDamien Neil <dneil@google.com>
Wed, 6 Nov 2024 21:01:09 +0000 (21:01 +0000)
commit23493579ead6512185bdb7a0bdfa512e9dea813e
treef449c6bcc6e2699d996a99d8f0b0bd8bfcb10e32
parent2c7b5ba8ca7268d7d38a48a7e6f31bb53e858af0
net/http: 308 redirects should use the previous hop's body

On a 301 redirect, the HTTP client changes the request to be
a GET with no body.

On a 308 redirect, the client leaves the request method and
body unchanged.

A 308 following a 301 should preserve the rewritten request
from the first redirect: GET with no body. We were preserving
the method, but sending the original body. Fix this.

Fixes #70180

Change-Id: Ie20027a6058a82bfdffc7197d07ac6c7f98099e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/626055
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/net/http/client.go
src/net/http/client_test.go