From e636e01ef36c3296b6a00f6cba03b2d5880e163f Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Tue, 22 Mar 2016 10:09:12 -0700 Subject: [PATCH] integrate Client Hints with Fetch - DPR, Save-Data, Viewport-Width are sent on navigation requests - Subresource requests are subject to the set client hints policy - Client Hints headers are treated as simple headers: each Client Hints heaer has a BNF grammar that should be validated bythe user agent. Closes: - https://github.com/whatwg/fetch/issues/52 - https://github.com/httpwg/http-extensions/issues/141 --- Overview.src.html | 101 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 94 insertions(+), 7 deletions(-) diff --git a/Overview.src.html b/Overview.src.html index 1de4835e8..98652d835 100644 --- a/Overview.src.html +++ b/Overview.src.html @@ -324,17 +324,35 @@

Headers


A simple header is a header whose -name is `Accept`, -`Accept-Language`, or `Content-Language`, or whose -name is `Content-Type` and -value, once parsed, -has a MIME type (ignoring parameters) that is -`application/x-www-form-urlencoded`, `multipart/form-data`, or -`text/plain`. +name is one of + +

+ +

or whose name is one of + +

+ +

and whose value, +once parsed, is not a failure. +

A forbidden header name is a header name that is one of @@ -804,6 +822,17 @@

Requests

an environment settings object. REFERRER +

A request has an associated +client hints list, which is a +client-hints list. Unless stated otherwise, it is +the empty list. + +

This will be used to override a client hints list associated with +an environment settings object. +CLIENT-HINTS + + +

A request has an associated synchronous flag. Unless stated otherwise it is unset. @@ -1387,6 +1416,15 @@

Referrer policies

REFERRER +

Client hints list

+ +

A client hints list is a list of +Client hint tokens, +each of which is one of `dpr`, +`save-data`, `viewport-width`, or +`width`. + +

Streams

This section might be integrated into other standards, such as IDL. @@ -1888,10 +1926,59 @@

Fetching

for HTTP/2, and equivalent information used to prioritize dispatch and processing of HTTP/1 fetches. + +
  • +

    If request is a navigation request, a user agent should, for each + header name + (hint-name) in the first column of the following table, if hint-name + is not in request's header list, + append + hint-name/hint-value given in the same row on the second column, to + request's header list. + + + + + + +
    hint-name + hint-value +
    `dpr` + a suitable dpr value +
    `save-data` + a suitable save-data value +
    `viewport-width` + a suitable viewport-width value +
    +

  • If request is a subresource request, run these substeps:

      +
    1. +

      If the request's client hints list is not empty, run these substeps for each hint-name in the list: + +

        +
      1. +

        Set value to the first matching statement, if any, switching on + hint-name: + +

        +
        "dpr" +
        a suitable dpr value +
        "save-data" +
        a suitable save-data value +
        "viewport-width" +
        a suitable viewport-width value +
        "width" +
        a suitable width value +
        + +
      2. Append + hint-name/value to request's + header list. +

      +
    2. Let record be a new fetch record consisting of request and this instance of the