-
Notifications
You must be signed in to change notification settings - Fork 381
Add Accept-CH-lifetime cache and CH header handling #729
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1744,7 +1744,6 @@ run these steps: | |
| <li><p>Return <b>allowed</b>. | ||
| </ol> | ||
|
|
||
|
|
||
| <h3 id=client-hints-list>Client hints list</h3> | ||
|
|
||
| <p class=note>This section will be integrated into HTTP Client Hints. | ||
|
|
@@ -1758,6 +1757,46 @@ of which is one of `<code>DPR</code>`, `<code>Save-Data</code>`, `<code>Viewport | |
| `<code>Width</code>`. | ||
|
|
||
|
|
||
| <h3 id=accept-ch-cache>Accept-CH cache</h3> | ||
|
|
||
| <p>An <dfn id=concept-accept-ch-cache>Accept-CH cache</dfn> is owned by the user agent and consists | ||
| of a collection of entries where each entry has these fields: | ||
|
|
||
| <ul class=brief> | ||
| <li><dfn id=concept-accept-ch-cache-origin for=accept-ch-cache>origin</dfn> (an <a for=/>origin</a>) | ||
| <li><dfn id=concept-accept-ch-cache-max-age for=accept-ch-cache>max-age</dfn> (a number of seconds) | ||
| <li><dfn id=concept-accept-ch-cache-client-hints-list for=accept-ch-cache>client-hints list</dfn> | ||
| </ul> | ||
|
|
||
| <p>Entries must be removed after the seconds specified in the | ||
| <a for=accept-ch-cache>max-age</a> field have passed since storing the entry. | ||
| Entries may be removed before that moment arrives. | ||
|
|
||
| <p>To <dfn id=concept-accept-ch-cache-create-entry for=accept-ch-cache>create a new entry</dfn> in | ||
| the <a>Accept-CH cache</a>, given <var>origin</var>, <var>max-age</var>, and | ||
| <var>client-hints list</var>, do so as follows: | ||
|
|
||
| <dl> | ||
| <dt><a for=accept-ch-cache>origin</a> | ||
| <dd><var>origin</var> | ||
|
|
||
| <dt><a for=accept-ch-cache>max-age</a> | ||
| <dd><var>max-age</var> | ||
|
|
||
| <dt><a for=accept-ch-cache>client-hints list</a> | ||
| <dd><var>client-hints list</var> | ||
| </dl> | ||
|
|
||
| <p>To <dfn export id=concept-retrieve-client-hints-list-accept-ch-cache>retrieve client-hints list</dfn>, | ||
| given an <var>origin</var>: | ||
| <ol> | ||
| <li>Let <var>client-hints list</var> be an empty list. | ||
| <li>Fetch any entries from <a>Accept-CH cache</a> which <a for=accept-ch-cache>origin</a> is | ||
| identical to <var>origin</var>. | ||
| <li>For each entry, for each token in its <a for=accept-ch-cache>client-hints list</a>, | ||
| if the token is not in <var>client-hints list</var>, add it. | ||
| <li>Return <var>client-hints list</var>. | ||
|
|
||
| <h3 id=streams>Streams</h3> | ||
|
|
||
| <p class="note no-backref">This section might be integrated into other standards, such as IDL. | ||
|
|
@@ -2897,6 +2936,19 @@ with a <i>CORS flag</i> and <i>recursive flag</i>, run these steps: | |
| <li><p><a href=https://w3c.github.io/webappsec-csp/#set-response-csp-list>Set <var>internalResponse</var>'s CSP list</a>. | ||
| [[!CSP]] | ||
|
|
||
| <li><p>If <var>response</var>'s | ||
| <a href=http://httpwg.org/http-extensions/client-hints.html#accept-ch>Accept-CH header</a> | ||
| is present, process the header and add its client-hints tokens to the <a>active document</a>'s | ||
|
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. Restrict to HTTPS only?
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. Yeah |
||
| client-hints list. | ||
|
|
||
| <!--TODO: define the active document's client hints list --> | ||
|
|
||
| <li><p>If <var>response</var>'s | ||
| <a href=http://httpwg.org/http-extensions/client-hints.html#accept-ch-lifetime>Accept-CH-Lifetime header</a> | ||
| is present, call | ||
| <a for=accept-ch-cache>create a new entry</a> with <var>response</var>'s <var>origin</var>, the | ||
|
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. Ditto, https-only? |
||
| parsed <var>max-age</var>, and the <a>active document</a>'s client-hints list. | ||
|
|
||
| <li> | ||
| <p>If <var>response</var> is not a <a>network error</a> and any | ||
| of the following algorithms returns <b>blocked</b>, then set <var>response</var> and | ||
|
|
||
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.
Do we need any extra clauses to ensure that this cache is purged when user clears site-data or similar?
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.
Probably
Uh oh!
There was an error while loading. Please reload this page.
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.
@mikewest what's the best way to hook this to clear-site-data and similar UI concepts (e.g. user cleared their cookies)? Looking at https://w3c.github.io/webappsec-clear-site-data/#clear-dom it seems to enumerate all the relevant things that need to be cleared? Should the ACHL cache do the same?