draft-ietf-httpbis-variants-01.txt   draft-ietf-httpbis-variants-latest.txt 
HTTP Working Group M. Nottingham HTTP Working Group M. Nottingham
Internet-Draft Fastly Internet-Draft Fastly
Updates: 7234 (if approved) May 1, 2018 Updates: 7234 (if approved) May 27, 2018
Intended status: Standards Track Intended status: Standards Track
Expires: November 2, 2018 Expires: November 28, 2018
HTTP Representation Variants HTTP Representation Variants
draft-ietf-httpbis-variants-01 draft-ietf-httpbis-variants-latest
Abstract Abstract
This specification introduces an alternative way to communicate a This specification introduces an alternative way to communicate a
secondary cache key for a HTTP resource, using the HTTP "Variants" secondary cache key for a HTTP resource, using the HTTP "Variants"
and "Variant-Key" response header fields. Its aim is to make HTTP and "Variant-Key" response header fields. Its aim is to make HTTP
proactive content negotiation more cache-friendly. proactive content negotiation more cache-friendly.
Note to Readers Note to Readers
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 https://datatracker.ietf.org/drafts/current/. Drafts is at https://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 November 2, 2018. This Internet-Draft will expire on November 28, 2018.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2018 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
(https://trustee.ietf.org/license-info) in effect on the date of (https://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 26 skipping to change at page 2, line 26
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4
2. The "Variants" HTTP Header Field . . . . . . . . . . . . . . 5 2. The "Variants" HTTP Header Field . . . . . . . . . . . . . . 5
2.1. Relationship to Vary . . . . . . . . . . . . . . . . . . 6 2.1. Relationship to Vary . . . . . . . . . . . . . . . . . . 6
3. The "Variant-Key" HTTP Header Field . . . . . . . . . . . . . 6 3. The "Variant-Key" HTTP Header Field . . . . . . . . . . . . . 7
3.1. Generating a Variant-Key List . . . . . . . . . . . . . . 7 3.1. Generating a Variant-Key List . . . . . . . . . . . . . . 7
4. Cache Behaviour . . . . . . . . . . . . . . . . . . . . . . . 8 4. Cache Behaviour . . . . . . . . . . . . . . . . . . . . . . . 8
4.1. Compute Possible Keys . . . . . . . . . . . . . . . . . . 9 4.1. Compute Possible Keys . . . . . . . . . . . . . . . . . . 9
4.2. Check Vary . . . . . . . . . . . . . . . . . . . . . . . 10 4.2. Check Vary . . . . . . . . . . . . . . . . . . . . . . . 10
4.3. Example of Cache Behaviour . . . . . . . . . . . . . . . 11 4.3. Example of Cache Behaviour . . . . . . . . . . . . . . . 11
5. Origin Server Behaviour . . . . . . . . . . . . . . . . . . . 11 5. Origin Server Behaviour . . . . . . . . . . . . . . . . . . . 11
5.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 12 5.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1.1. Single Variant . . . . . . . . . . . . . . . . . . . 12 5.1.1. Single Variant . . . . . . . . . . . . . . . . . . . 12
5.1.2. Multiple Variants . . . . . . . . . . . . . . . . . . 13 5.1.2. Multiple Variants . . . . . . . . . . . . . . . . . . 13
5.1.3. Partial Coverage . . . . . . . . . . . . . . . . . . 13 5.1.3. Partial Coverage . . . . . . . . . . . . . . . . . . 14
6. Defining Content Negotiation Using Variants . . . . . . . . . 14 6. Defining Content Negotiation Using Variants . . . . . . . . . 14
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15
8. Security Considerations . . . . . . . . . . . . . . . . . . . 15 8. Security Considerations . . . . . . . . . . . . . . . . . . . 15
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 15 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 15
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 15 9.1. Normative References . . . . . . . . . . . . . . . . . . 15
10.1. Normative References . . . . . . . . . . . . . . . . . . 16 9.2. Informative References . . . . . . . . . . . . . . . . . 16
10.2. Informative References . . . . . . . . . . . . . . . . . 16 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 16
10.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Appendix A. Variants for Existing Content Negotiation Mechanisms 17 Appendix A. Variants for Existing Content Negotiation Mechanisms 17
A.1. Accept . . . . . . . . . . . . . . . . . . . . . . . . . 17 A.1. Accept . . . . . . . . . . . . . . . . . . . . . . . . . 17
A.2. Accept-Encoding . . . . . . . . . . . . . . . . . . . . . 18 A.2. Accept-Encoding . . . . . . . . . . . . . . . . . . . . . 18
A.3. Accept-Language . . . . . . . . . . . . . . . . . . . . . 18 A.3. Accept-Language . . . . . . . . . . . . . . . . . . . . . 18
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 19
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 19 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 19
1. Introduction 1. Introduction
HTTP proactive content negotiation ([RFC7231], Section 3.4.1) is HTTP proactive content negotiation ([RFC7231], Section 3.4.1) is
seeing renewed interest, both for existing request headers like seeing renewed interest, both for existing request headers like
Content-Language and for newer ones (for example, see Content-Language and for newer ones (for example, see
[I-D.ietf-httpbis-client-hints]). [I-D.ietf-httpbis-client-hints]).
Successfully reusing negotiated responses that have been stored in a Successfully reusing negotiated responses that have been stored in a
skipping to change at page 6, line 30 skipping to change at page 6, line 33
cacheable (as per [RFC7234], Section 3) responses for a resource, cacheable (as per [RFC7234], Section 3) responses for a resource,
since its absence will trigger caches to fall back to Vary since its absence will trigger caches to fall back to Vary
processing. processing.
Likewise, servers MUST send the Variant-Key response header field Likewise, servers MUST send the Variant-Key response header field
when sending Variants, since its absence means that the stored when sending Variants, since its absence means that the stored
response will not be reused when this specification is implemented. response will not be reused when this specification is implemented.
2.1. Relationship to Vary 2.1. Relationship to Vary
Caches that implement this specification SHOULD ignore request header This specification updates [RFC7234] to allow caches that implement
fields in the Vary header for the purposes of secondary cache key this specification to ignore request header fields in the Vary header
calculation ([RFC7234], Section 4.1) when their semantics are for the purposes of secondary cache key calculation ([RFC7234],
implemented as per this specification and their corresponding Section 4.1) when their semantics are implemented as per this
response header field is listed in Variants. specification and their corresponding response header field is listed
in Variants.
If any member of the Vary header does not have a corresponding If any member of the Vary header does not have a corresponding
variant that is understood by the implementation, it is still subject variant that is understood by the implementation, it is still subject
to the requirements there. to the requirements there.
See Section 5.1.3 for an example. See Section 5.1.3 for an example.
In practice, implementation of Vary varies considerably. As a In practice, implementation of Vary varies considerably. As a
result, cache efficiency might drop considerably when Variants does result, cache efficiency might drop considerably when Variants does
not contain all of the headers referenced by Vary, because some not contain all of the headers referenced by Vary, because some
implementations might choose to disable Variants processing when this implementations might choose to disable Variants processing when this
is the case. is the case.
3. The "Variant-Key" HTTP Header Field 3. The "Variant-Key" HTTP Header Field
The Variant-Key HTTP response header field is used to indicate the The Variant-Key HTTP response header field is used to indicate the
values from the Variants header field that identify the values from the Variants header field that identify the
representation it occurs within. representation it occurs within.
Variant-Key = available-values Variant-Key = 1#available-values
available-values = available-value *( ";" available-value ) available-values = available-value *( ";" available-value )
Each member of the list contains the selected available-value(s), in Each member of the list contains the selected available-value(s), in
the same order as the variants listed in the Variants header field. the same order as the variants listed in the Variants header field.
Therefore, Variant-Key MUST be the same length (in comma-separated Therefore, Variant-Key MUST be the same length (in comma-separated
members) as Variants, and each member MUST correspond in position to members) as Variants, and each member MUST correspond in position to
its companion in Variants. its companion in Variants.
For example: For example:
skipping to change at page 8, line 31 skipping to change at page 8, line 37
Caches that implement the Variants header field and the relevant Caches that implement the Variants header field and the relevant
semantics of the field-name it contains can use that knowledge to semantics of the field-name it contains can use that knowledge to
either select an appropriate stored representation, or forward the either select an appropriate stored representation, or forward the
request if no appropriate representation is stored. request if no appropriate representation is stored.
They do so by running this algorithm (or its functional equivalent) They do so by running this algorithm (or its functional equivalent)
upon receiving a request: upon receiving a request:
Given incoming-request, a mapping of field-names to lists of field Given incoming-request, a mapping of field-names to lists of field
values, and stored-responses, a list of stored responses suitable for values, and stored-responses, a list of stored responses suitable for
reuse as defined in [RFC7234] Section 4, excepting the requirement to reuse as defined in Section 4 of [RFC7234], excepting the requirement
calculate a secondary cache key: to calculate a secondary cache key:
1. If stored-responses is empty, return an empty list. 1. If stored-responses is empty, return an empty list.
2. Order stored-responses by the "Date" header field, most recent to 2. Order stored-responses by the "Date" header field, most recent to
least recent. least recent.
3. Let sorted-variants be an empty list. 3. Let sorted-variants be an empty list.
4. If the freshest member of stored-responses (as per [RFC7234], 4. If the freshest member of stored-responses (as per [RFC7234],
Section 4.2) has one or more "Variants" header field(s): Section 4.2) has one or more "Variants" header field(s):
skipping to change at page 15, line 36 skipping to change at page 15, line 44
8. Security Considerations 8. Security Considerations
If the number or advertised characteristics of the representations If the number or advertised characteristics of the representations
available for a resource are considered sensitive, the Variants available for a resource are considered sensitive, the Variants
header by its nature will leak them. header by its nature will leak them.
Note that the Variants header is not a commitment to make Note that the Variants header is not a commitment to make
representations of a certain nature available; the runtime behaviour representations of a certain nature available; the runtime behaviour
of the server always overrides hints like Variants. of the server always overrides hints like Variants.
9. Acknowledgments 9. References
This protocol is conceptually similar to, but simpler than,
Transparent Content Negotiation [RFC2295]. Thanks to its authors for
their inspiration.
It is also a generalisation of a Fastly VCL feature designed by
Rogier 'DocWilco' Mulhuijzen.
Thanks to Hooman Beheshti for his review and input.
10. References 9.1. Normative References
10.1. Normative References
[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,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC4647] Phillips, A. and M. Davis, "Matching of Language Tags", [RFC4647] Phillips, A. and M. Davis, "Matching of Language Tags",
BCP 47, RFC 4647, DOI 10.17487/RFC4647, September 2006, BCP 47, RFC 4647, DOI 10.17487/RFC4647, September 2006,
<https://www.rfc-editor.org/info/rfc4647>. <https://www.rfc-editor.org/info/rfc4647>.
skipping to change at page 16, line 39 skipping to change at page 16, line 33
[RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
RFC 7234, DOI 10.17487/RFC7234, June 2014, RFC 7234, DOI 10.17487/RFC7234, June 2014,
<https://www.rfc-editor.org/info/rfc7234>. <https://www.rfc-editor.org/info/rfc7234>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
10.2. Informative References 9.2. Informative References
[I-D.ietf-httpbis-client-hints] [I-D.ietf-httpbis-client-hints]
Grigorik, I., "HTTP Client Hints", draft-ietf-httpbis- Grigorik, I., "HTTP Client Hints", draft-ietf-httpbis-
client-hints-05 (work in progress), January 2018. client-hints-05 (work in progress), January 2018.
[RFC2295] Holtman, K. and A. Mutz, "Transparent Content Negotiation [RFC2295] Holtman, K. and A. Mutz, "Transparent Content Negotiation
in HTTP", RFC 2295, DOI 10.17487/RFC2295, March 1998, in HTTP", RFC 2295, DOI 10.17487/RFC2295, March 1998,
<https://www.rfc-editor.org/info/rfc2295>. <https://www.rfc-editor.org/info/rfc2295>.
[RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
Procedures for Message Header Fields", BCP 90, RFC 3864, Procedures for Message Header Fields", BCP 90, RFC 3864,
DOI 10.17487/RFC3864, September 2004, DOI 10.17487/RFC3864, September 2004,
<https://www.rfc-editor.org/info/rfc3864>. <https://www.rfc-editor.org/info/rfc3864>.
10.3. URIs 9.3. URIs
[1] https://lists.w3.org/Archives/Public/ietf-http-wg/ [1] https://lists.w3.org/Archives/Public/ietf-http-wg/
[2] https://httpwg.github.io/ [2] https://httpwg.github.io/
[3] https://github.com/httpwg/http-extensions/labels/variants [3] https://github.com/httpwg/http-extensions/labels/variants
[4] https://github.com/mnot/variants-toy [4] https://github.com/mnot/variants-toy
Appendix A. Variants for Existing Content Negotiation Mechanisms Appendix A. Variants for Existing Content Negotiation Mechanisms
This appendix defines the required information to use existing This appendix defines the required information to use existing
proactive content negotiation mechanisms (as defined in [RFC7231], proactive content negotiation mechanisms (as defined in [RFC7231],
Section 5.3) with the Variants header field. Section 5.3) with the Variants header field.
A.1. Accept A.1. Accept
This section defines handling for Accept variants, as per [RFC7231] This section defines handling for Accept variants, as per
Section 5.3.2. Section 5.3.2 of [RFC7231].
To perform content negotiation for Accept given a request-value and To perform content negotiation for Accept given a request-value and
available-values: available-values:
1. Let preferred-available be an empty list. 1. Let preferred-available be an empty list.
2. Let preferred-types be a list of the types in the request-value, 2. Let preferred-types be a list of the types in the request-value,
ordered by their weight, highest to lowest, as per [RFC7231] ordered by their weight, highest to lowest, as per Section 5.3.2
Section 5.3.2 (omitting any coding with a weight of 0). If of [RFC7231] (omitting any coding with a weight of 0). If
"Accept" is not present or empty, preferred-types will be empty. "Accept" is not present or empty, preferred-types will be empty.
If a type lacks an explicit weight, an implementation MAY assign If a type lacks an explicit weight, an implementation MAY assign
one. one.
3. If the first member of available-values is not a member of 3. If the first member of available-values is not a member of
preferred-types, append it to preferred-types (thus making it the preferred-types, append it to preferred-types (thus making it the
default). default).
4. For each preferred-type in preferred-types: 4. For each preferred-type in preferred-types:
1. If any member of available-values matches preferred-type, 1. If any member of available-values matches preferred-type,
using the media-range matching mechanism specified in using the media-range matching mechanism specified in
[RFC7231] Section 5.3.2 (which is case-insensitive), append Section 5.3.2 of [RFC7231] (which is case-insensitive),
those members of available-values to preferred-available append those members of available-values to preferred-
(preserving the precedence order implied by the media ranges' available (preserving the precedence order implied by the
specificity). media ranges' specificity).
5. Return preferred-available. 5. Return preferred-available.
Note that this algorithm explicitly ignores extension parameters on Note that this algorithm explicitly ignores extension parameters on
media types (e.g., "charset"). media types (e.g., "charset").
A.2. Accept-Encoding A.2. Accept-Encoding
This section defines handling for Accept-Encoding variants, as per This section defines handling for Accept-Encoding variants, as per
[RFC7231] Section 5.3.4. Section 5.3.4 of [RFC7231].
To perform content negotiation for Accept-Encoding given a request- To perform content negotiation for Accept-Encoding given a request-
value and available-values: value and available-values:
1. Let preferred-available be an empty list. 1. Let preferred-available be an empty list.
2. Let preferred-codings be a list of the codings in the request- 2. Let preferred-codings be a list of the codings in the request-
value, ordered by their weight, highest to lowest, as per value, ordered by their weight, highest to lowest, as per
[RFC7231] Section 5.3.1 (omitting any coding with a weight of 0). Section 5.3.1 of [RFC7231] (omitting any coding with a weight of
If "Accept-Encoding" is not present or empty, preferred-codings 0). If "Accept-Encoding" is not present or empty, preferred-
will be empty. If a coding lacks an explicit weight, an codings will be empty. If a coding lacks an explicit weight, an
implementation MAY assign one. implementation MAY assign one.
3. If "identity" is not a member of preferred-codings, append 3. If "identity" is not a member of preferred-codings, append
"identity". "identity".
4. Append "identity" to available-values. 4. Append "identity" to available-values.
5. For each preferred-coding in preferred-codings: 5. For each preferred-coding in preferred-codings:
1. If there is a case-insensitive, character-for-character match 1. If there is a case-insensitive, character-for-character match
for preferred-coding in available-values, append that member for preferred-coding in available-values, append that member
of available-values to preferred-available. of available-values to preferred-available.
6. Return preferred-available. 6. Return preferred-available.
Note that the unencoded variant needs to have a Variant-Key header Note that the unencoded variant needs to have a Variant-Key header
field with a value of "identity" (as defined in [RFC7231] field with a value of "identity" (as defined in Section 5.3.4 of
Section 5.3.4). [RFC7231]).
A.3. Accept-Language A.3. Accept-Language
This section defines handling for Accept-Language variants, as per This section defines handling for Accept-Language variants, as per
[RFC7231] Section 5.3.5. Section 5.3.5 of [RFC7231].
To perform content negotiation for Accept-Language given a request- To perform content negotiation for Accept-Language given a request-
value and available-values: value and available-values:
1. Let preferred-available be an empty list. 1. Let preferred-available be an empty list.
2. Let preferred-langs be a list of the language-ranges in the 2. Let preferred-langs be a list of the language-ranges in the
request-value, ordered by their weight, highest to lowest, as per request-value, ordered by their weight, highest to lowest, as per
[RFC7231] Section 5.3.1 (omitting any language-range with a Section 5.3.1 of [RFC7231] (omitting any language-range with a
weight of 0). If a language-range lacks a weight, an weight of 0). If a language-range lacks a weight, an
implementation MAY assign one. implementation MAY assign one.
3. If the first member of available-values is not a member of 3. If the first member of available-values is not a member of
preferred-langs, append it to preferred-langs (thus making it the preferred-langs, append it to preferred-langs (thus making it the
default). default).
4. For each preferred-lang in preferred-langs: 4. For each preferred-lang in preferred-langs:
1. If any member of available-values matches preferred-lang, 1. If any member of available-values matches preferred-lang,
using either the Basic or Extended Filtering scheme defined using either the Basic or Extended Filtering scheme defined
in [RFC4647] Section 3.3, append those members of available- in Section 3.3 of [RFC4647], append those members of
values to preferred-available (preserving their order). available-values to preferred-available (preserving their
order).
5. Return preferred-available. 5. Return preferred-available.
Acknowledgements
This protocol is conceptually similar to, but simpler than,
Transparent Content Negotiation [RFC2295]. Thanks to its authors for
their inspiration.
It is also a generalisation of a Fastly VCL feature designed by
Rogier 'DocWilco' Mulhuijzen.
Thanks to Hooman Beheshti for his review and input.
Author's Address Author's Address
Mark Nottingham Mark Nottingham
Fastly Fastly
Email: mnot@mnot.net Email: mnot@mnot.net
URI: https://www.mnot.net/ URI: https://www.mnot.net/
 End of changes. 26 change blocks. 
52 lines changed or deleted 55 lines changed or added

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