-
Notifications
You must be signed in to change notification settings - Fork 551
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
fetch: send 'sec-purpose' header for prefetch requests #3694
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test or enable one in the wpts?
There are no viable WPTs for server implementations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trivikr |
@@ -136,7 +137,7 @@ class Request { | |||
} | |||
|
|||
// 4. Set request to a new request whose URL is parsedURL. | |||
request = makeRequest({ urlList: [parsedURL] }) | |||
request = makeRequest({ urlList: [parsedURL], ...init }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KhafraDev Is this right???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
Co-authored-by: Trivikram Kamat <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request.initiator will always be null therefore sec-purpose will never be added. It's fine to have the condition that adds it in case the spec ever changes, but most of the other stuff should be removed.
{ | ||
key: 'initiator', | ||
converter: webidl.converters.DOMString, | ||
// https://fetch.spec.whatwg.org/#concept-request-initiator | ||
allowedValues: requestInitiator | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. A Request's request (internal state) contains an initiator, not RequestInit
@@ -136,7 +137,7 @@ class Request { | |||
} | |||
|
|||
// 4. Set request to a new request whose URL is parsedURL. | |||
request = makeRequest({ urlList: [parsedURL] }) | |||
request = makeRequest({ urlList: [parsedURL], ...init }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong
This relates to...
Step 14 in WHATWG fetch specification https://fetch.spec.whatwg.org/#http-network-or-cache-fetch, added in whatwg/fetch#1576
Changes
Sends 'sec-purpose' header for prefetch requests as per WHATWG fetch specification
Features
N/A
Bug Fixes
N/A
Breaking Changes and Deprecations
N/A
Status