[whatwg/fetch] 303 redirects should preserve HEAD (#753)

(@yutakahirano passed this along to me to dig into.)

The Fetch spec, in step 11 here, says: "If either actualResponse’s status is 301 or 302 and request’s method is `POST`, or actualResponse’s status is 303, set request’s method to `GET` and request’s body to null."
https://fetch.spec.whatwg.org/#http-redirect-fetch

This implies that a 303 in response to a HEAD gets converted to GET. However wpt says it stays as a HEAD. That is Chrome's behavior as well and, loading the tests in Firefox, seem to be Firefox's behavior.
http://w3c-test.org/fetch/api/redirect/redirect-method.any.html

Our behavior appears to date to here:
https://bugs.chromium.org/p/chromium/issues/detail?id=102130
https://trac.ietf.org/trac/httpbis/ticket/310
which cites what ultimately became the new HTTP RFCs.

The "clarification" in the IETF specification is absurdly unclear, but the intent and reality do seem to align on 303 not transforming HEAD. Additionally, it seems odd for a HEAD request (which expects no body) to ultimately receive a GET response (which has a body). So I believe this is just a mistake in the Fetch spec.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/753

Received on Friday, 1 June 2018 22:38:04 UTC