-
Notifications
You must be signed in to change notification settings - Fork 381
Align CH processing model with implementation and HTML#3774 #773
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
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2031149
Align client-hints processing with Chromium's implementation
yoavweiss b533da4
Check Feature Policy before sending Client Hints
eeeps 5c94e8b
Add Feature-Policy biblio reference
eeeps 5b7f379
Fix up PR from @eeeps according to IRC discussion
yoavweiss 5a74cf7
Remove the cross-origin condition
yoavweiss 3da867b
Remove vars from algo name
yoavweiss 7b72f9a
Trying to fix client-hints set linking
yoavweiss 8a2fed1
Removed for from dfn
yoavweiss 9b53f62
Sec prefix, redirect 3P handling, response density
yoavweiss 7050b3e
Add hints from Tarun Bansal's PR #725
yoavweiss 8b1d633
Fix up sec processing
yoavweiss 5067615
s/list/set/
yoavweiss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,14 @@ url:https://tools.ietf.org/html/rfc7234#section-1.2.1;text:delta-seconds;type:df | |
| }, | ||
| "OCSP": { | ||
| "aliasOf": "RFC2560" | ||
| }, | ||
| "FEATURE-POLICY": { | ||
| "authors": [ | ||
| "Ian Clelland" | ||
| ], | ||
| "href": "https://wicg.github.io/feature-policy/", | ||
| "publisher": "WICG", | ||
| "title": "Feature Policy" | ||
| } | ||
| } | ||
| </pre> | ||
|
|
@@ -637,6 +645,9 @@ production as | |
| <ol> | ||
| <li><p>Let <var>value</var> be <var>header</var>'s <a for=header>value</a>. | ||
|
|
||
| <li><p>If <var>header</var>'s <a for=header>name</a> starts with a <a>byte-case-insensitive</a> | ||
| match to `Sec-`, return true. | ||
|
|
||
| <li> | ||
| <p><a>Byte-lowercase</a> <var>header</var>'s <a for=header>name</a> and switch on the result: | ||
|
|
||
|
|
@@ -1295,6 +1306,15 @@ to not have to set <a for=/>request</a>'s <a for=request>referrer</a>. | |
| <p class="note no-backref">This can be used to override a referrer policy associated with an | ||
| <a>environment settings object</a>. | ||
|
|
||
| <p>A <a for=/>request</a> has an associated | ||
| <dfn export for=request id=concept-request-client-hints-set>client-hints set</dfn>, | ||
| which is a <a lt="client-hints set">client-hints set</a>. Unless stated | ||
| otherwise, it is the empty set. | ||
|
|
||
| <p class="note no-backref">This will be used to override a client-hints set associated with | ||
| an <a>environment settings object</a>. | ||
| [[!CLIENT-HINTS]] | ||
|
|
||
| <p>A <a for=/>request</a> has an associated | ||
| <dfn id=synchronous-flag export for=request>synchronous flag</dfn>. Unless stated otherwise it is | ||
| unset. | ||
|
|
@@ -1750,6 +1770,10 @@ initially unset. | |
| being provided to an API that didn't make a range request. See the flag's usage for a detailed | ||
| description of the attack. | ||
|
|
||
| <p>A <a for=/>response</a> has an associated | ||
| <dfn for=response id=concept-response-image-density>image density</dfn>, which is initially set to | ||
| zero. | ||
|
|
||
| <p>A <a for=/>response</a> can have an associated | ||
| <dfn export for=response id=concept-response-location-url>location URL</dfn> (null, failure, or a | ||
| <a for=/>URL</a>). Unless specified otherwise, <a for=/>response</a> has no | ||
|
|
@@ -2115,6 +2139,18 @@ run these steps: | |
| </ol> | ||
|
|
||
|
|
||
| <h3 id=client-hints-set>Client-hints set</h3> | ||
|
|
||
| <p>A <dfn export id=concept-client-hints-set>client-hints set</dfn> is a | ||
| <a for=/>set</a> of | ||
| <a href=http://httpwg.org/http-extensions/client-hints.html#accept-ch>Client hint tokens</a>, each | ||
| of which is one of `<code>DPR</code>`, `<code>Save-Data</code>`, `<code>Viewport-Width</code>`, | ||
| `<code>Width</code>`, `<code>Device-Memory</code>`, `<code>RTT</code>`, `<code>Downlink</code>`, or | ||
| `<code>ECT</code>`. | ||
|
|
||
|
|
||
| `<code>Width</code>`. | ||
|
|
||
| <h3 id=streams>Streams</h3> | ||
|
|
||
| <p class="note no-backref">This section might be integrated into other standards, such as IDL. | ||
|
|
@@ -3062,6 +3098,10 @@ the request. | |
| <a for=request>origin</a> to <var>request</var>'s | ||
| <a for=request>client</a>'s <a for="environment settings object">origin</a>. | ||
|
|
||
| <li><p>Set <var>request</var>'s <a for=request>client-hints set</a> to be a <a for=list>clone</a> | ||
| of the <a for="environment settings object">client-hints set</a> of the <var>request</var>'s | ||
| <a for=request>client</a>'s <a for="environment settings object">global object</a>. | ||
|
|
||
| <li> | ||
| <p>If <var>request</var>'s <a for=request>header list</a> | ||
| <a for="header list">does not contain</a> `<code>Accept</code>`, then: | ||
|
|
@@ -3107,20 +3147,81 @@ the request. | |
| HTTP/1 fetches. | ||
|
|
||
| <li> | ||
| <p>If <var>request</var> is a <a>subresource request</a>, then: | ||
|
|
||
| <ol> | ||
| <li><p>Let <var>record</var> be a new | ||
| <a for="fetch group">fetch record</a> consisting of | ||
| <var>request</var> and this instance of the | ||
| <a for=/>fetch</a> algorithm. | ||
|
|
||
| <li><p>Append <var>record</var> to <var>request</var>'s | ||
| <a for=request>client</a>'s | ||
| <a for=fetch>fetch group</a> list of | ||
| <a for="fetch group">fetch records</a>. | ||
| </ol> | ||
| </ol> | ||
| <p>If <var>request</var> is a <a>navigation request</a>, a user agent should, for each | ||
| <a for=/>header</a> <a for=header>name</a> (<var>hintName</var>) in the first column of the | ||
| following table, if <var>request</var>'s <a for=request>header list</a> | ||
| <a for="header list">does not contain</a> <var>hintName</var>, then | ||
| <a for="header list">append</a> | ||
| <var>hintName</var>/the value given in the same row on the second column, to | ||
| <var>request</var>'s <a for=request>header list</a>. | ||
|
|
||
| <table> | ||
| <tbody><tr> | ||
| <th><a for=header>Name</a> | ||
| <th><a for=header>Value</a> | ||
| <tr> | ||
| <td>`<code>Save-Data</code>` | ||
| <td>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#save-data>save-data value</a> | ||
| </table> | ||
|
|
||
| <li> | ||
|
|
||
| <p><a for=list>For each</a> <var>hintName</var> of <var>request</var>'s | ||
| <a for=request>client-hints set</a>: | ||
|
|
||
| <ol> | ||
| <li> | ||
| <p>Let <var>value</var> be the first matching statement, switching on <var>hintName</var>: | ||
|
|
||
| <dl class=switch> | ||
| <dt>`<code>DPR</code>` | ||
| <dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#dpr>dpr value</a> | ||
| <dt>`<code>Save-Data</code>` | ||
| <dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#save-data>save-data value</a> | ||
| <dt>`<code>Viewport-Width</code>` | ||
| <dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#viewport-width>viewport-width value</a> | ||
| <dt>`<code>Width</code>` | ||
| <dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#width>width value</a> | ||
| <dt>`<code>Device-Memory</code>` | ||
| <dd>a suitable <a href=https://w3c.github.io/device-memory/#sec-device-memory-client-hint-header>Device-Memory value</a> | ||
| <dt>`<code>RTT</code>` | ||
| <dd>a suitable <a href=https://wicg.github.io/netinfo/#rtt-request-header-field>RTT value</a> | ||
| <dt>`<code>Downlink</code>` | ||
| <dd>a suitable <a href=https://wicg.github.io/netinfo/#downlink-request-header-field>Downlink value</a> | ||
| <dt>`<code>ECT</code>` | ||
| <dd>a suitable <a href=https://wicg.github.io/netinfo/#ect-request-header-field>ECT value</a> | ||
| </dl> | ||
|
|
||
| <li><p>If <var>request</var> is a <a>subresource request</a> and the result of running <a | ||
| href="https://wicg.github.io/feature-policy/#should-request-be-allowed-to-use-feature">Should | ||
| request be allowed to use feature?</a>, given <var>request</var> and <var>hintName</var>’s | ||
| <a href="http://httpwg.org/http-extensions/client-hints.html#opt-in-via-feature-policy">associated | ||
| policy-controlled feature</a>, returns <code>false</code>, then skip the next steps and | ||
| continue to the next <var>hintName</var>. | ||
| [[!FEATURE-POLICY]] [[!CLIENT-HINTS]] | ||
|
|
||
| <!-- TODO(yoav): Fix the above Feature policy link --> | ||
| <!-- TODO(yoav): Fix the Client hints reference to the HTML one, once it lands --> | ||
| <li><p>Set <var>hintName</var> to "Sec-" concatenated with <var>hintName</var>. | ||
|
|
||
| <li><p>If <var>request</var>'s <a for=request>header list</a> <a for="header list">does not | ||
| contain</a> <var>hintName</var>, a user agent should <a for="header list">append</a> | ||
| <var>hintName</var>/<var>value</var> to <var>request</var>'s <a for=request>header list</a>. | ||
| </ol> | ||
|
|
||
| <li><p>If <var>request</var> is a <a>subresource request</a>, then: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation is off here as well.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ack |
||
| <ol> | ||
| <li><p>Let <var>record</var> be a new | ||
| <a for="fetch group">fetch record</a> consisting of | ||
| <var>request</var> and this instance of the | ||
| <a for=/>fetch</a> algorithm. | ||
|
|
||
| <li><p>Append <var>record</var> to <var>request</var>'s | ||
| <a for=request>client</a>'s | ||
| <a for=fetch>fetch group</a> list of | ||
| <a for="fetch group">fetch records</a>. | ||
| </ol> | ||
| </ol> | ||
|
|
||
| <li> | ||
| <p><a>If aborted</a>, then: | ||
|
|
@@ -3494,6 +3595,12 @@ with a <i>CORS flag</i> and <i>recursive flag</i>, run these steps: | |
| <a>queue a fetch-request-done task</a> for <var>request</var>. | ||
| </ol> | ||
|
|
||
| <li><p>If <var>request</var>'s destination is "image" and <var>response</var>'s | ||
| <a for=response>header list</a> <a for="header list">contains</a> | ||
| `<code>Content-DPR</code>`, set <var>response</var>'s <a for=response>image density</a> value to the | ||
| result of parsing the header value as float. | ||
| <!-- TODO: propoerly link parse as float --> | ||
|
|
||
| <li><p><a>Queue a fetch task</a> on <var>request</var> to | ||
| <a>process response</a> for <var>response</var>. | ||
|
|
||
|
|
@@ -3857,6 +3964,20 @@ optional <i>CORS flag</i> and <i>CORS-preflight flag</i>, run these steps: | |
| not <a>same origin</a> with <var>actualResponse</var>'s <a for=response>location URL</a>'s | ||
| <a for=url>origin</a>, then return a <a>network error</a>. | ||
|
|
||
| <li><p><a for=list>For each</a> <var>hintName</var> of <var>request</var>'s | ||
| <a for=request>client-hints set</a>: | ||
| <ol> | ||
| <li><p>Set <var>hintName</var> to "Sec-" concatenated with <var>hintName</var>. | ||
| <li><p>If <var>request</var>'s <a for=request>header list</a> <a for="header list"> contains</a> | ||
| <var>hintName</var> and if the result of running <a | ||
| href="https://wicg.github.io/feature-policy/#should-request-be-allowed-to-use-feature">Should | ||
| request be allowed to use feature?</a>, given <var>request</var> and <var>hintName</var>’s | ||
| <a href="http://httpwg.org/http-extensions/client-hints.html#opt-in-via-feature-policy">associated | ||
| policy-controlled feature</a>, returns <code>false</code>, then remove <var>hintName</var> from | ||
| <a for=request>header list</a>. | ||
| [[!FEATURE-POLICY]] [[!CLIENT-HINTS]] | ||
| </ol> | ||
|
|
||
| <li> | ||
| <p>If <i>CORS flag</i> is set and <var>actualResponse</var>'s | ||
| <a for=response>location URL</a> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Add the other new hints here?
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.
yup