Re: [whatwg/fetch] Use request's current url as base URL in redirects (#633)

So there's basically four types of redirect responses:

1. A `Response.redirect()` response.
2. A `new Response()` response (with status and `Location` set appropriately).
3. A fresh network response.
4. A reused network response.

1 is different from 2 because 1 always has an absolute URL and therefore always goes to the same URL.

This PR as it stands ensures 3 and 4 always go to the same URL. This does not match Chrome and Firefox, but does match Safari. Given https://fetch.spec.whatwg.org/#atomic-http-redirect-handling it seems good to me that the client side cannot fiddle with the intent of the server, even if it was weakly stated (with a relative URL) and therefore I'd argue we align with Safari.

One approach we could take here is that 2 becomes a network error or "not a redirect" (just a response that happens to look like one). This would be easy to accomplish using the https://fetch.spec.whatwg.org/#concept-response-location-url field and setting it for 1.

I quite like that idea, but I'd like to solicit feedback on that from you all first. (An alternative is that 2 remains an oddball redirect response whose location varies on who requests it, but that seems a little less clean.)

cc @youennf @yutakahirano @mattto @hober 

-- 
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/pull/633#issuecomment-381529516

Received on Monday, 16 April 2018 09:01:08 UTC