This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28343 - "manual redirect flag"
Summary: "manual redirect flag"
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Fetch (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+fetchspec
URL:
Whiteboard:
Keywords:
: 26238 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-03-26 14:33 UTC by Mike West
Modified: 2015-03-27 12:31 UTC (History)
5 users (show)

See Also:


Attachments

Description Mike West 2015-03-26 14:33:15 UTC
https://fetch.spec.whatwg.org/#concept-request-manual-redirect-flag

[[
manual redirect flag
]]

It would be nice if we had a mechanism of setting this (or anything like it) when calling into `fetch()`. This would give us the ability to mitigate certain risks by ensuring that data meant for one location isn't accidentally redirected to another.
Comment 1 Anne 2015-03-26 14:43:25 UTC
Tentative proposal:

  errorOnRedirect = false

as we cannot expose redirects directly which the "manual redirect flag" does (and is needed for internal algorithms such as "navigate").

When this property is set we'd set the manual redirect flag and reject with a TypeError if a redirect of sorts is returned.

It will also be reflected on Request of course.
Comment 2 Mike West 2015-03-26 14:49:37 UTC
Sounds fine to me. My only requirement is the ability to assert that a particular request will touch _only_ a specific URL, and will otherwise fail. I'm happy with any mechanism you're happy with that achieves that result.

[insert questions about service workers here]
Comment 3 Anne 2015-03-26 14:53:54 UTC
Oh, you want to make such an assertion from a document with a service worker not being able to affect it? Because that would be impossible as far as I can tell.
Comment 4 Mike West 2015-03-26 15:00:57 UTC
(In reply to Anne from comment #3)
> Oh, you want to make such an assertion from a document with a service worker
> not being able to affect it? Because that would be impossible as far as I
> can tell.

If it wasn't impossible, yes! I'd love that! :)
Comment 5 Anne 2015-03-27 10:13:12 UTC
Manual redirect flag is now a mode:

https://github.com/whatwg/fetch/commit/83981498175633510878ebf97077ec632ceedc29

My plan is to expose "follow" and "error" to JavaScript and leave "manual" for HTML's navigate algorithm and any future controlled request context algorithms.

Judging from RequestInit today, it would be something like:

  .redirect = "error"
Comment 6 Anne 2015-03-27 12:29:42 UTC
*** Bug 26238 has been marked as a duplicate of this bug. ***