Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 24aead4

Browse files
committedApr 5, 2016
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: - #52 - httpwg/http-extensions#141
1 parent 667ca32 commit 24aead4

File tree

1 file changed

+87
-7
lines changed

1 file changed

+87
-7
lines changed
 

‎Overview.src.html

+87-7
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,35 @@ <h4 id=terminology-headers>Headers</h4>
324324
<hr>
325325

326326
<p>A <dfn>simple header</dfn> is a <span title=concept-header>header</span> whose
327-
<span title=concept-header-name>name</span> is `<code title>Accept</code>`,
328-
`<code title>Accept-Language</code>`, or `<code title>Content-Language</code>`, or whose
329-
<span title=concept-header-name>name</span> is `<code title>Content-Type</code>` and
330-
<span title=concept-header-value>value</span>, <span title=concept-header-parse>once parsed</span>,
331-
has a MIME type (ignoring parameters) that is
332-
`<code title>application/x-www-form-urlencoded</code>`, `<code title>multipart/form-data</code>`, or
333-
`<code title>text/plain</code>`.
327+
<span title=concept-header-name>name</span> is one of
328+
329+
<ul class=brief>
330+
<li>`<code title>Accept</code>`
331+
<li>`<code title>Accept-Language</code>`
332+
<li>`<code title>Content-Language</code>`
333+
<li>`<code title>Content-Type</code>` and whose <span title=concept-header-value>value</span>,
334+
<span title=concept-header-parse>once parsed</span>, has a MIME type (ignoring parameters)
335+
that is `<code title>application/x-www-form-urlencoded</code>`,
336+
`<code title>multipart/form-data</code>`, or `<code title>text/plain</code>`
337+
</ul>
338+
334339
<!-- XXX * needs better xref
335340
* ignoring parameters has been the standard for a long time now
336341
* interesting test: "Content-Type: text/plain;" -->
337342

343+
<p>or whose <span title=concept-header-name>name</span> is one of
344+
345+
<ul class=brief>
346+
<li>`<code title><a href=http://httpwg.org/http-extensions/client-hints.html#dpr>DPR</a></code>`
347+
<li>`<code title><a href=http://httpwg.org/http-extensions/client-hints.html#downlink>Downlink</a></code>`
348+
<li>`<code title><a href=http://httpwg.org/http-extensions/client-hints.html#save-data>Save-Data</a></code>`
349+
<li>`<code title><a href=http://httpwg.org/http-extensions/client-hints.html#viewport-width>Viewport-Width</a></code>`
350+
<li>`<code title><a href=http://httpwg.org/http-extensions/client-hints.html#width>Width</a></code>`
351+
</ul>
352+
353+
<p>and whose <span title=concept-header-value>value</span>,
354+
<span title=concept-header-parse>once parsed</span>, is not a failure.
355+
338356
<p>A <dfn>forbidden header name</dfn> is a <span title=concept-header>header</span>
339357
<span title=concept-header-name>name</span> that is one of
340358

@@ -804,6 +822,15 @@ <h4>Requests</h4>
804822
an <span data-anolis-spec=html>environment settings object</span>.
805823
<span data-anolis-ref>REFERRER</span>
806824

825+
<p>A <span title=concept-request>request</span> has an associated
826+
<dfn title=concept-request-client-hints-list>client hints list</dfn>, which is a
827+
<span title=concept-client-hints-list>client-hints list</span>. Unless stated otherwise, it is
828+
the empty list.
829+
830+
<p class="note no-backref">This can be used to override a client hints list associated with
831+
an <span data-anolis-spec=html>environment settings object</span>.
832+
<span data-anolis-ref>CLIENT-HINTS</span>
833+
807834
<p>A <span title=concept-request>request</span> has an associated
808835
<dfn>synchronous flag</dfn>. Unless stated otherwise it is unset.
809836

@@ -1387,6 +1414,15 @@ <h3>Referrer policies</h3>
13871414
<span data-anolis-ref>REFERRER</span>
13881415

13891416

1417+
<h3>Client hints list</h3>
1418+
1419+
<p>A <dfn title=concept-client-hints-list>client hints list</dfn> is a list of
1420+
<a href=http://httpwg.org/http-extensions/client-hints.html#accept-ch>Client hint tokens</a>,
1421+
each of which is one of `<code title>dpr</code>`,
1422+
`<code title>save-data</code>`, `<code title>viewport-width</code>`, or
1423+
`<code title>width</code>`.
1424+
1425+
13901426
<h3>Streams</h3>
13911427

13921428
<p class="note no-backref">This section might be integrated into other standards, such as IDL.
@@ -1888,10 +1924,54 @@ <h2>Fetching</h2>
18881924
for HTTP/2, and equivalent information used to prioritize dispatch and processing of
18891925
HTTP/1 fetches.
18901926

1927+
1928+
<li>
1929+
<p>If <var>request</var> is a <span>navigation request</span>, a user agent should, for each <span title=concept-header>header</span>
1930+
<span title=concept-header-name>name</span> (<var>hint-name</var>) in the
1931+
first column of the following table, if <var>hint-name</var> is not in
1932+
<var>request</var>'s <span title=concept-request-header-list>header list</span>,
1933+
<span title=concept-header-list-append>append</span>
1934+
<var>hint-name</var>/<var>hint-value</var> given in the same row on the
1935+
second column, to <var> request</var>'s
1936+
<span title=concept-request-header-list>header list</span>.
1937+
1938+
<table>
1939+
<tr>
1940+
<th><span title=hint-name>hint-name</span>
1941+
<th><span title=hint-value>hint-value</span>
1942+
<tr>
1943+
<td>`<code title=http-dpr>dpr</a></code>`
1944+
<td>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#dpr>dpr value</a>
1945+
<tr>
1946+
<td>`<code title=http-save-data>save-data</code>`
1947+
<td>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#save-data>save-data value</a>
1948+
<tr>
1949+
<td>`<code title=http-viewport-width>viewport-width</code>`
1950+
<td>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#viewport-width>viewport-width value</a>
1951+
</table>
1952+
18911953
<li>
18921954
<p>If <var>request</var> is a <span>subresource request</span>, run these substeps:
18931955

18941956
<ol>
1957+
<li><p>If the <var>request</var>'s <span title=concept-client-hint-list>client hints list</span> is not empty, run these substeps for each <var>hint-name</var> in the list:
1958+
<ol>
1959+
<li><p>Set <var>value</var> to the first matching statement, if any, switching on <var>hint-name</var>:
1960+
<dl class=switch>
1961+
<dt>"<code title>dpr</code>"
1962+
<dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#dpr>dpr value</a>
1963+
<dt>"<code title>save-data</code>"
1964+
<dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#save-data>save-data value</a>
1965+
<dt>"<code title>viewport-width</code>"
1966+
<dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#viewport-width>viewport-width value</a>
1967+
<dt>"<code title>width</code>"
1968+
<dd>a suitable <a href=http://httpwg.org/http-extensions/client-hints.html#width>width value</a></code>
1969+
</dl>
1970+
<li><p><span title=concept-header-list-append>Append</span>
1971+
<var>hint-name</var>/<var>value</var> to <var>request</var>'s
1972+
<span title=concept-request-header-list>header list</span>.
1973+
</ol>
1974+
18951975
<li><p>Let <var>record</var> be a new
18961976
<span title=concept-fetch-record>fetch record</span> consisting of
18971977
<var>request</var> and this instance of the

0 commit comments

Comments
 (0)
Please sign in to comment.