draft-ietf-httpbis-client-hints-01.txt   draft-ietf-httpbis-client-hints-02.txt 
HTTP Working Group I. Grigorik HTTP Working Group I. Grigorik
Internet-Draft Google Internet-Draft Google
Intended status: Standards Track May 31, 2016 Intended status: Experimental October 4, 2016
Expires: December 2, 2016 Expires: April 7, 2017
HTTP Client Hints HTTP Client Hints
draft-ietf-httpbis-client-hints-01 draft-ietf-httpbis-client-hints-02
Abstract Abstract
An increasing diversity of Web-connected devices and software An increasing diversity of Web-connected devices and software
capabilities has created a need to deliver optimized content for each capabilities has created a need to deliver optimized content for each
device. device.
This specification defines a set of HTTP request header fields, This specification defines a set of HTTP request header fields,
colloquially known as Client Hints, to address this. They are colloquially known as Client Hints, to address this. They are
intended to be used as input to proactive content negotiation; just intended to be used as input to proactive content negotiation; just
skipping to change at page 1, line 49 skipping to change at page 1, line 49
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 2, 2016. This Internet-Draft will expire on April 7, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the Copyright (c) 2016 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 34 skipping to change at page 2, line 34
2. Client Hint Request Header Fields . . . . . . . . . . . . . . 4 2. Client Hint Request Header Fields . . . . . . . . . . . . . . 4
2.1. Sending Client Hints . . . . . . . . . . . . . . . . . . 4 2.1. Sending Client Hints . . . . . . . . . . . . . . . . . . 4
2.2. Server Processing of Client Hints . . . . . . . . . . . . 4 2.2. Server Processing of Client Hints . . . . . . . . . . . . 4
2.2.1. Advertising Support for Client Hints . . . . . . . . 4 2.2.1. Advertising Support for Client Hints . . . . . . . . 4
2.2.2. Interaction with Caches . . . . . . . . . . . . . . . 5 2.2.2. Interaction with Caches . . . . . . . . . . . . . . . 5
3. The DPR Client Hint . . . . . . . . . . . . . . . . . . . . . 6 3. The DPR Client Hint . . . . . . . . . . . . . . . . . . . . . 6
3.1. Confirming Selected DPR . . . . . . . . . . . . . . . . . 6 3.1. Confirming Selected DPR . . . . . . . . . . . . . . . . . 6
4. The Width Client Hint . . . . . . . . . . . . . . . . . . . . 7 4. The Width Client Hint . . . . . . . . . . . . . . . . . . . . 7
5. The Viewport-Width Client Hint . . . . . . . . . . . . . . . 7 5. The Viewport-Width Client Hint . . . . . . . . . . . . . . . 7
6. The Downlink Client Hint . . . . . . . . . . . . . . . . . . 7 6. The Downlink Client Hint . . . . . . . . . . . . . . . . . . 7
7. The Save-Data Client Hint . . . . . . . . . . . . . . . . . . 7 7. The Save-Data Client Hint . . . . . . . . . . . . . . . . . . 8
8. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 8
9. Security Considerations . . . . . . . . . . . . . . . . . . . 9 9. Security Considerations . . . . . . . . . . . . . . . . . . . 9
10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
10.1. Accept-CH . . . . . . . . . . . . . . . . . . . . . . . 9 10.1. Accept-CH . . . . . . . . . . . . . . . . . . . . . . . 10
10.2. Content-DPR . . . . . . . . . . . . . . . . . . . . . . 9 10.2. Content-DPR . . . . . . . . . . . . . . . . . . . . . . 10
10.3. Downlink . . . . . . . . . . . . . . . . . . . . . . . . 10 10.3. Downlink . . . . . . . . . . . . . . . . . . . . . . . . 10
10.4. DPR . . . . . . . . . . . . . . . . . . . . . . . . . . 10 10.4. DPR . . . . . . . . . . . . . . . . . . . . . . . . . . 10
10.5. Save-Data . . . . . . . . . . . . . . . . . . . . . . . 10 10.5. Save-Data . . . . . . . . . . . . . . . . . . . . . . . 10
10.6. Viewport-Width . . . . . . . . . . . . . . . . . . . . . 10 10.6. Viewport-Width . . . . . . . . . . . . . . . . . . . . . 11
10.7. Width . . . . . . . . . . . . . . . . . . . . . . . . . 10 10.7. Width . . . . . . . . . . . . . . . . . . . . . . . . . 11
11. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 11
11.1. Normative References . . . . . . . . . . . . . . . . . . 11 11.1. Normative References . . . . . . . . . . . . . . . . . . 11
11.2. Informative References . . . . . . . . . . . . . . . . . 12 11.2. Informative References . . . . . . . . . . . . . . . . . 12
Appendix A. Changes . . . . . . . . . . . . . . . . . . . . . . 12 Appendix A. Changes . . . . . . . . . . . . . . . . . . . . . . 12
A.1. Since -00 . . . . . . . . . . . . . . . . . . . . . . . . 12 A.1. Since -00 . . . . . . . . . . . . . . . . . . . . . . . . 12
A.2. Since -01 . . . . . . . . . . . . . . . . . . . . . . . . 12 A.2. Since -01 . . . . . . . . . . . . . . . . . . . . . . . . 12
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 12 A.3. Since -02 . . . . . . . . . . . . . . . . . . . . . . . . 13
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13
1. Introduction 1. Introduction
There are thousands of different devices accessing the web, each with There are thousands of different devices accessing the web, each with
different device capabilities and preference information. These different device capabilities and preference information. These
device capabilities include hardware and software characteristics, as device capabilities include hardware and software characteristics, as
well as dynamic user and client preferences. well as dynamic user and client preferences.
One way to infer some of these capabilities is through User-Agent One way to infer some of these capabilities is through User-Agent
(UA; Section 5.5.3 of [RFC7231]) detection against an established (UA; Section 5.5.3 of [RFC7231]) detection against an established
skipping to change at page 3, line 50 skipping to change at page 3, line 50
proactive content negotiation. proactive content negotiation.
1.1. Notational Conventions 1.1. Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119]. document are to be interpreted as described in [RFC2119].
This document uses the Augmented Backus-Naur Form (ABNF) notation of This document uses the Augmented Backus-Naur Form (ABNF) notation of
[RFC5234] with the list rule extension defined in [RFC7230], [RFC5234] with the list rule extension defined in [RFC7230],
Appendix B. It includes by reference the DIGIT rule from [RFC5234]; Appendix B. It includes by reference the DIGIT rule from [RFC5234]
the OWS, field-name and quoted-string rules from [RFC7230]; and the and the OWS and field-name rules from [RFC7230].
parameter rule from [RFC7231].
2. Client Hint Request Header Fields 2. Client Hint Request Header Fields
A Client Hint request header field is a HTTP header field that is A Client Hint request header field is a HTTP header field that is
used by HTTP clients to indicate configuration data that can be used used by HTTP clients to indicate configuration data that can be used
by the server to select an appropriate response. Each one conveys a by the server to select an appropriate response. Each one conveys a
list of client preferences that the server can use to adapt and list of client preferences that the server can use to adapt and
optimize the response. optimize the response.
2.1. Sending Client Hints 2.1. Sending Client Hints
skipping to change at page 4, line 30 skipping to change at page 4, line 30
The client and server, or an intermediate proxy, can use an opt-in The client and server, or an intermediate proxy, can use an opt-in
mechanism to negotiate which fields should be reported to allow for mechanism to negotiate which fields should be reported to allow for
efficient content adaption. efficient content adaption.
2.2. Server Processing of Client Hints 2.2. Server Processing of Client Hints
Servers respond with an optimized response based on one or more Servers respond with an optimized response based on one or more
received hints from the client. When doing so, and if the resource received hints from the client. When doing so, and if the resource
is cacheable, the server MUST also emit a Vary response header field is cacheable, the server MUST also emit a Vary response header field
(Section 7.1.4 of [RFC7231]), and optionally Key (Section 7.1.4 of [RFC7231]), and optionally Key
([I-D.ietf-httpbis-key]), to indicate which hints were used and ([I-D.ietf-httpbis-key]), to indicate which hints can affect the
whether the selected response is appropriate for a later request. selected response and whether the selected response is appropriate
for a later request.
Further, depending on the used hint, the server can emit additional Further, depending on the used hint, the server can emit additional
response header fields to confirm the property of the response, such response header fields to confirm the property of the response, such
that the client can adjust its processing. For example, this that the client can adjust its processing. For example, this
specification defines "Content-DPR" response header field that needs specification defines "Content-DPR" response header field that needs
to be returned by the server when the "DPR" hint is used to select to be returned by the server when the "DPR" hint is used to select
the response. the response.
2.2.1. Advertising Support for Client Hints 2.2.1. Advertising Support for Client Hints
Servers can advertise support for Client Hints using the Accept-CH Servers can advertise support for Client Hints using the Accept-CH
header field or an equivalent HTML meta element with http-equiv header field or an equivalent HTML meta element with http-equiv
attribute ([W3C.REC-html5-20141028]). attribute ([W3C.REC-html5-20141028]).
Accept-CH = #token Accept-CH = #field-name
For example: For example:
Accept-CH: DPR, Width, Viewport-Width, Downlink Accept-CH: DPR, Width, Viewport-Width, Downlink
When a client receives Accept-CH, it SHOULD append the Client Hint When a client receives Accept-CH, or if it is capable of processing
header fields that match the advertised field-values. For example, the HTML response and finds an equivalent HTML meta element, it
based on Accept-CH example above, the client would append DPR, Width, SHOULD append the Client-Hint header fields that match the advertised
Viewport-Width, and Downlink header fields to all subsequent field-values to the header list of all subsequent requests. For
requests. example, based on Accept-CH example above, a user agent could append
DPR, Width, Viewport-Width, and Downlink header fields to all
subresource requests initiated by the page constructed from the
response. Alternatively, a client can treat advertised support as a
persistent origin preference and append same header fields on all
future requests initiated to and by the resources associated with
that origin.
2.2.2. Interaction with Caches 2.2.2. Interaction with Caches
When selecting an optimized response based on one or more Client When selecting an optimized response based on one or more Client
Hints, and if the resource is cacheable, the server needs to emit a Hints, and if the resource is cacheable, the server needs to emit a
Vary response header field ([RFC7234]) to indicate which hints were Vary response header field ([RFC7234]) to indicate which hints can
used and whether the selected response is appropriate for a later affect the selected response and whether the selected response is
request. appropriate for a later request.
Vary: DPR Vary: DPR
Above example indicates that the cache key needs to include the DPR Above example indicates that the cache key needs to include the DPR
header field. header field.
Vary: DPR, Width, Downlink Vary: DPR, Width, Downlink
Above example indicates that the cache key needs to include the DPR, Above example indicates that the cache key needs to include the DPR,
Width, and Downlink header fields. Width, and Downlink header fields.
skipping to change at page 7, line 10 skipping to change at page 7, line 15
client. client.
If Content-DPR occurs in a message more than once, the last value If Content-DPR occurs in a message more than once, the last value
overrides all previous occurrences. overrides all previous occurrences.
4. The Width Client Hint 4. The Width Client Hint
The "Width" request header field is a number that indicates the The "Width" request header field is a number that indicates the
desired resource width in physical px (i.e. intrinsic size of an desired resource width in physical px (i.e. intrinsic size of an
image). The provided physical px value is a number rounded to the image). The provided physical px value is a number rounded to the
largest smallest following integer (i.e. ceiling value). smallest following integer (i.e. ceiling value).
Width = 1*DIGIT Width = 1*DIGIT
If the desired resource width is not known at the time of the request If the desired resource width is not known at the time of the request
or the resource does not have a display width, the Width header field or the resource does not have a display width, the Width header field
can be omitted. If Width occurs in a message more than once, the can be omitted. If Width occurs in a message more than once, the
last value overrides all previous occurrences. last value overrides all previous occurrences.
5. The Viewport-Width Client Hint 5. The Viewport-Width Client Hint
The "Viewport-Width" request header field is a number that indicates The "Viewport-Width" request header field is a number that indicates
the layout viewport width in CSS px. The provided CSS px value is a the layout viewport width in CSS px. The provided CSS px value is a
number rounded to the largest smallest following integer (i.e. number rounded to the smallest following integer (i.e. ceiling
ceiling value). value).
Viewport-Width = 1*DIGIT Viewport-Width = 1*DIGIT
If Viewport-Width occurs in a message more than once, the last value If Viewport-Width occurs in a message more than once, the last value
overrides all previous occurrences. overrides all previous occurrences.
6. The Downlink Client Hint 6. The Downlink Client Hint
The "Downlink" request header field is a number that indicates the The "Downlink" request header field is a number that indicates the
client's maximum downlink speed in megabits per second (Mbps), as client's maximum downlink speed in megabits per second (Mbps), as
defined by the "downlinkMax" attribute in the W3C Network Information defined by the "downlinkMax" attribute in the W3C Network Information
API ([NETINFO]). API ([NETINFO]).
Downlink = 1*DIGIT [ "." 1*DIGIT ] Downlink = 1*DIGIT [ "." 1*DIGIT ]
If Downlink occurs in a message more than once, the minimum value If Downlink occurs in a message more than once, the minimum value
should be used to override other occurrences. should be used to override other occurrences.
7. The Save-Data Client Hint 7. The Save-Data Client Hint
The "Save-Data" request header field is a token that indicates The "Save-Data" request header field consists of one or more tokens
client's preference for reduced data usage, due to high transfer that indicate client's preference for reduced data usage, due to high
costs, slow connection speeds, or other reasons. transfer costs, slow connection speeds, or other reasons.
Save-Data : sd-token *( ";" [sd-token] ) Save-Data = sd-token *( OWS ";" OWS [sd-token] )
sd-token = token sd-token = token
This document defines the "on" sd-token value, which is used as a This document defines the "on" sd-token value, which is used as a
signal indicating explicit user opt-in into a reduced data usage mode signal indicating explicit user opt-in into a reduced data usage mode
on the client, and when communicated to origins allows them to on the client, and when communicated to origins allows them to
deliver alternate content honoring such preference - e.g. smaller deliver alternate content honoring such preference - e.g. smaller
image and video resources, alternate markup, and so on. New token image and video resources, alternate markup, and so on. New token
and extension token values can only be defined by revisions of this and extension token values can only be defined by revisions of this
specification. specification.
skipping to change at page 9, line 12 skipping to change at page 9, line 17
Downlink: 0.384 Downlink: 0.384
The server knows that the client's maximum downlink speed is The server knows that the client's maximum downlink speed is
0.384Mbps (GPRS EDGE), and it can use this information to select an 0.384Mbps (GPRS EDGE), and it can use this information to select an
optimized resource - for example, an alternate image asset, optimized resource - for example, an alternate image asset,
stylesheet, HTML document, media stream, and so on. stylesheet, HTML document, media stream, and so on.
9. Security Considerations 9. Security Considerations
Client Hints defined in this specification do not expose any new Client Hints defined in this specification do not expose new
information about the user's environment beyond what is already information about the user's environment beyond what is already
available to, and can be communicated by, the application at runtime available to, and can be communicated by, the application at runtime
via JavaScript - e.g. viewport and image display width, device pixel via JavaScript and CSS. For example, the application can obtain
ratio, and so on. viewport width, image display width, and device pixel ratio via
JavaScript, or through the use of CSS media queries and unique
resource URLs even if JavaScript is disabled. However, implementors
should consider the privacy implications of various methods to enable
delivery of Client Hints - see "Sending Client Hints" section.
However, implementors should consider the privacy implications of For example, sending Client Hints on all requests can make
various methods to enable delivery of Client Hints - see "Sending information about the user's environment available to origins that
Client Hints" section. For example, sending Client Hints on all otherwise did not have access to this data, which may or may not be
requests can make information about the user's environment available the desired outcome - e.g. this may enable an image optimization
to origins that otherwise did not have access to this data (e.g. service to deliver a tailored asset, and it may reveal same
origins hosting non-script resources), which might or not be the information about the user to other origins that may not have had
desired outcome. The implementors can provide mechanisms to control access to it before. Similarly, sending highly granular data, such
such behavior via explicit opt-in, or other mechanisms. Similarly, as image and viewport width may help identify users across multiple
the implementors should consider how and whether delivery of Client requests. Restricting such field values to an enumerated range,
Hints is affected when the user is in "incognito" or similar privacy where the user agent advertises a threshold value that is close but
mode. is not an exact representation of the current value, might reduce
such fingerprinting risks.
The implementers can provide mechanisms and policies to control how
and when such hints are advertised: require origin opt-in and
restrict delivery to same origin subrequests; limit delivery to
requests that already carry indentifying information (e.g. cookies);
modify delivery policy when in an "incognito" or a similar privacy
mode; enable user configuration and opt in, and so on.
10. IANA Considerations 10. IANA Considerations
This document defines the "Accept-CH", "DPR", "Width", and "Downlink" This document defines the "Accept-CH", "DPR", "Width", and "Downlink"
HTTP request fields, "Content-DPR" HTTP response field, and registers HTTP request fields, "Content-DPR" HTTP response field, and registers
them in the Permanent Message Header Fields registry. them in the Permanent Message Header Fields registry.
10.1. Accept-CH 10.1. Accept-CH
o Header field name: Accept-CH o Header field name: Accept-CH
skipping to change at page 11, line 14 skipping to change at page 11, line 32
11. References 11. References
11.1. Normative References 11.1. Normative References
[CSS2] Bos, B., Celic, T., Hickson, I., and H. Lie, "Cascading [CSS2] Bos, B., Celic, T., Hickson, I., and H. Lie, "Cascading
Style Sheets Level 2 Revision 1 (CSS 2.1) Specification", Style Sheets Level 2 Revision 1 (CSS 2.1) Specification",
W3C Recommendation REC-CSS2-20110607, June 2011, W3C Recommendation REC-CSS2-20110607, June 2011,
<http://www.w3.org/TR/2011/REC-CSS2-20110607>. <http://www.w3.org/TR/2011/REC-CSS2-20110607>.
[I-D.ietf-httpbis-key]
Fielding, R. and M. Nottingham, "The Key HTTP Response
Header Field", draft-ietf-httpbis-key-01 (work in
progress), March 2016.
[NETINFO] Caceres, M., Moreno, F., and I. Grigorik, "Network [NETINFO] Caceres, M., Moreno, F., and I. Grigorik, "Network
Information API", December 2015, <https://w3c.github.io/ Information API", December 2015, <https://w3c.github.io/
netinfo/>. netinfo/>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>. <http://www.rfc-editor.org/info/rfc2119>.
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
skipping to change at page 12, line 7 skipping to change at page 12, line 23
<http://www.rfc-editor.org/info/rfc7234>. <http://www.rfc-editor.org/info/rfc7234>.
[W3C.CR-css-values-3-20150611] [W3C.CR-css-values-3-20150611]
Atkins, T. and E. Etemad, "CSS Values and Units Module Atkins, T. and E. Etemad, "CSS Values and Units Module
Level 3", World Wide Web Consortium CR CR-css-values- Level 3", World Wide Web Consortium CR CR-css-values-
3-20150611, June 2015, 3-20150611, June 2015,
<http://www.w3.org/TR/2015/CR-css-values-3-20150611>. <http://www.w3.org/TR/2015/CR-css-values-3-20150611>.
[W3C.REC-html5-20141028] [W3C.REC-html5-20141028]
Hickson, I., Berjon, R., Faulkner, S., Leithead, T., Hickson, I., Berjon, R., Faulkner, S., Leithead, T.,
Navara, E., O&#039;Connor, E., and S. Pfeiffer, "HTML5", Navara, E., O&#039;Connor, T., and S. Pfeiffer, "HTML5",
World Wide Web Consortium Recommendation REC- World Wide Web Consortium Recommendation REC-
html5-20141028, October 2014, html5-20141028, October 2014,
<http://www.w3.org/TR/2014/REC-html5-20141028>. <http://www.w3.org/TR/2014/REC-html5-20141028>.
11.2. Informative References 11.2. Informative References
[I-D.ietf-httpbis-key]
Fielding, R. and M. Nottingham, "The Key HTTP Response
Header Field", draft-ietf-httpbis-key-01 (work in
progress), March 2016.
[RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265,
DOI 10.17487/RFC6265, April 2011, DOI 10.17487/RFC6265, April 2011,
<http://www.rfc-editor.org/info/rfc6265>. <http://www.rfc-editor.org/info/rfc6265>.
Appendix A. Changes Appendix A. Changes
A.1. Since -00 A.1. Since -00
o Issue 168 (make Save-Data extensible) updated ABNF. o Issue 168 (make Save-Data extensible) updated ABNF.
o Issue 163 (CH review feedback) editorial feedback from httpwg o Issue 163 (CH review feedback) editorial feedback from httpwg
list. list.
o Issue 153 (NetInfo API citation) added normative reference. o Issue 153 (NetInfo API citation) added normative reference.
A.2. Since -01 A.2. Since -01
o Issue 200: Moved Key reference to informative.
o Issue 215: Extended passive fingerprinting and mitigation
considerations.
o Changed document status to experimental.
A.3. Since -02
None yet. None yet.
Author's Address Author's Address
Ilya Grigorik Ilya Grigorik
Google Google
Email: ilya@igvita.com Email: ilya@igvita.com
URI: https://www.igvita.com/ URI: https://www.igvita.com/
 End of changes. 23 change blocks. 
51 lines changed or deleted 78 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/