8000 Fetching with a particular destination · Issue #521 · whatwg/fetch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fetching with a particular destination #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jakearchibald opened this issue Mar 31, 2017 · 7 comments
Closed

Fetching with a particular destination #521

jakearchibald opened this issue Mar 31, 2017 · 7 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: api

Comments

@jakearchibald
Copy link
Collaborator

Some browsers will change their headings based on the type of request, eg Chrome will include image/webp in the Accept header for image requests.

Should we have an API to create requests that contain these details? Eg Request.as('image', url, opts).

Moved from w3c/ServiceWorker#945

@annevk
Copy link
Member
annevk commented Mar 31, 2017

The main question is how this relates to CSP and what that means with respect to constraints on the response. (We could make a parallel field I suppose that only affects Accept headers and priorities and such, but that doesn't seem great.)

See also #43 and #64.

@annevk annevk changed the title Fetching as a particular type Fetching with a particular destination Sep 5, 2017
@annevk
Copy link
Member
annevk commented Sep 5, 2017

Updated the title to reflect type being folded into destination, but the same general concern applies. Consider, a site safelists image-src requests, but not connect-src. This would allow you to read arbitrary third-party data with fetch(), despite that CSP policy.

@annevk
Copy link
Member
annevk commented Apr 11, 2018

@jakearchibald do you still wish to pursue this?

@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: api labels Apr 11, 2018
@jakearchibald
Copy link
Collaborator Author

@annevk it isn't something I've had many requests for. The main use case is when caching content, you want the correct accept header for images. Happy to close for now until we work out the CSP parts.

@yoavweiss
Copy link
Collaborator

The main use case is when caching content, you want the correct accept header for images

I assumed that the accept headers are set before the SW gets the request (and therefore passed along when fetch()ing the same request). Is that not the case?

@yoavweiss
Copy link
Collaborator

nm. I thought this is somewhat similar to #717 but re-reading this, the use-case is about creating a Request from scratch. Apologies for the noise

@jakearchibald
Copy link
Collaborator Author

@yoavweiss yeah, but the accept header for webP isn't there if you do cache.add('/path/to/img') since it isn't an image request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: api
Development

No branches or pull requests

3 participants
0