From 23d551f9199eed390a50274021b7f2d7168e9256 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Tue, 22 May 2018 14:28:46 +0200 Subject: [PATCH] Add Accept-CH-lifetime cache and header handling --- fetch.bs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index e7ae3b1af..c1ac990c9 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1744,7 +1744,6 @@ run these steps:
  • Return allowed. -

    Client hints list

    This section will be integrated into HTTP Client Hints. @@ -1758,6 +1757,46 @@ of which is one of `DPR`, `Save-Data`, `Viewport `Width`. +

    Accept-CH cache

    + +

    An Accept-CH cache is owned by the user agent and consists + of a collection of entries where each entry has these fields: + +

      +
    • origin (an origin) +
    • max-age (a number of seconds) +
    • client-hints list +
    + +

    Entries must be removed after the seconds specified in the +max-age field have passed since storing the entry. +Entries may be removed before that moment arrives. + +

    To create a new entry in +the Accept-CH cache, given origin, max-age, and +client-hints list, do so as follows: + +

    +
    origin +
    origin + +
    max-age +
    max-age + +
    client-hints list +
    client-hints list +
    + +

    To retrieve client-hints list, +given an origin: +

      +
    1. Let client-hints list be an empty list. +
    2. Fetch any entries from Accept-CH cache which origin is +identical to origin. +
    3. For each entry, for each token in its client-hints list, +if the token is not in client-hints list, add it. +
    4. Return client-hints list. +

      Streams

      This section might be integrated into other standards, such as IDL. @@ -2897,6 +2936,19 @@ with a CORS flag and recursive flag, run these steps:

    5. Set internalResponse's CSP list. [[!CSP]] +

    6. If response's + Accept-CH header + is present, process the header and add its client-hints tokens to the active document's + client-hints list. + + + +

    7. If response's + Accept-CH-Lifetime header + is present, call + create a new entry with response's origin, the + parsed max-age, and the active document's client-hints list. +

    8. If response is not a network error and any of the following algorithms returns blocked, then set response and