Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variants dictionary keys must be lowercase #988

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions draft-ietf-httpbis-variants.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ HTTP/1.1 200 OK
Content-Type: text/html
Content-Language: en
Vary: Accept-Language
Variants: Accept-Language;de;en;jp
Variant-Key: en
Variants: accept-language=(de en jp)
Variant-Key: (en)
Transfer-Encoding: chunked

[English content]
Expand Down Expand Up @@ -141,7 +141,7 @@ Note that an available-value that is a token is interpreted as a string containi
So, given this example header field:

~~~ example
Variants: Accept-Encoding=(gzip)
Variants: accept-encoding=(gzip)
~~~

a recipient can infer that the only content-coding available for that resource is "gzip" (along with the "identity" non-encoding; see {{content-encoding}}).
Expand All @@ -157,14 +157,14 @@ a recipient can infer that no content-codings (beyond identity) are supported. N
A more complex example:

~~~ example
Variants: Accept-Encoding=(gzip br), Accept-Language=(en fr)
Variants: accept-encoding=(gzip br), accept-language=(en fr)
~~~

Here, recipients can infer that two content-codings in addition to "identity" are available, as well as two content languages. Note that, as with all Structured Header dictionaries, they might occur in the same header field or separately, like this:

~~~ example
Variants: Accept-Encoding=(gzip brotli)
Variants: Accept-Language=(en fr)
Variants: accept-encoding=(gzip brotli)
Variants: accept-language=(en fr)
~~~

The ordering of available-values is significant, as it might be used by the header's algorithm for selecting a response (in this example, the first language is the default; see {{content-language}}).
Expand Down Expand Up @@ -210,7 +210,7 @@ Each inner-list member is treated as identifying an available-value for the corr
For example:

~~~ example
Variants: Accept-Encoding=(gzip br), Accept-Language=(en fr)
Variants: accept-encoding=(gzip br), accept-language=(en fr)
Variant-Key: (gzip fr)
~~~

Expand All @@ -219,7 +219,7 @@ This header pair indicates that the representation has a "gzip" content-coding a
If the response can be used to satisfy more than one request, they can be listed in additional members. For example:

~~~ example
Variants: Accept-Encoding=(gzip br), Accept-Language=(en fr)
Variants: accept-encoding=(gzip br), accept-language=(en fr)
Variant-Key: (gzip fr), ("identity" fr)
~~~

Expand All @@ -228,7 +228,7 @@ indicates that this response can be used for requests whose Accept-Encoding algo
When more than one Variant-Key value is in a response, the first one present MUST correspond to the request that caused that response to be generated. For example:

~~~ example
Variants: Accept-Encoding=(gzip br), Accept-Language=(en fr)
Variants: accept-encoding=(gzip br), accept-language=(en fr)
Variant-Key: (gzip fr), (identity fr), (br fr oops)
~~~

Expand Down Expand Up @@ -312,7 +312,7 @@ Note that implementation of the Vary header field varies in practice, and the al
For example, if the selected variants-header was:

~~~ example
Variants: Accept-Language=(en fr de), Accept-Encoding=(gzip br)
Variants: accept-language=(en fr de), accept-encoding=(gzip br)
~~~

and the request contained the headers:
Expand Down Expand Up @@ -355,7 +355,7 @@ it could be used to satisfy the first preference. If not, responses correspondin
If the selected variants-header was:

~~~ example
Variants: Accept-Language=(en fr de)
Variants: accept-language=(en fr de)
~~~

And a request comes in with the following headers:
Expand Down Expand Up @@ -386,7 +386,7 @@ Then the cache needs to forward the request to the origin server, since Variants
If the selected variants-header was:

~~~ example
Variants: Accept-Language=(en fr de)
Variants: accept-language=(en fr de)
~~~

And a request comes in with the following headers:
Expand Down Expand Up @@ -437,7 +437,7 @@ HTTP/1.1 200 OK
Content-Type: image/gif
Content-Language: en
Cache-Control: max-age=3600
Variants: Accept-Language=(en de)
Variants: accept-language=(en de)
Variant-Key: (en)
Vary: Accept-Language
Transfer-Encoding: chunked
Expand Down Expand Up @@ -470,8 +470,8 @@ HTTP/1.1 200 OK
Content-Type: image/gif
Content-Language: en
Content-Encoding: br
Variants: Accept-Language=(en jp de)
Variants: Accept-Encoding=(br gzip)
Variants: accept-language=(en jp de)
Variants: accept-encoding=(br gzip)
Variant-Key: (en br)
Vary: Accept-Language, Accept-Encoding
Transfer-Encoding: chunked
Expand Down Expand Up @@ -499,7 +499,7 @@ HTTP/1.1 200 OK
Content-Type: image/gif
Content-Language: en
Content-Encoding: br
Variants: Accept-Encoding=(br gzip)
Variants: accept-encoding=(br gzip)
Variant-Key: (br)
Vary: Accept-Language, Accept-Encoding
Transfer-Encoding: chunked
Expand Down Expand Up @@ -641,7 +641,7 @@ To perform content negotiation for Cookie given a request-value and available-va
A simple example is allowing a page designed for users that aren't logged in (denoted by the `logged_in` cookie-name) to be cached:

~~~ example
Variants: Cookie=(logged_in)
Variants: cookie=(logged_in)
Variant-Key: (0)
Vary: Cookie
~~~
Expand All @@ -651,7 +651,7 @@ Here, a cache that implements Variants will only use this response to satisfy re
Or, consider this example:

~~~ example
Variants: Cookie=(user_priority)
Variants: cookie=(user_priority)
Variant-Key: (silver), ("bronze")
Vary: Cookie
~~~
Expand All @@ -661,7 +661,7 @@ Here, the `user_priority` cookie-name allows requests from "gold" users to be se
It is possible to target a response to a single user; for example:

~~~ example
Variants: Cookie=(user_id)
Variants: cookie=(user_id)
Variant-Key: (some_person)
Vary: Cookie
~~~
Expand All @@ -671,7 +671,7 @@ Here, only the "some_person" `user_id` will have this response served to them ag
Note that if more than one cookie-name serves as a cache key, they'll need to be listed in separate Variants members, like this:

~~~ example
Variants: Cookie=(user_priority), Cookie=(user_region)
Variants: cookie=(user_priority), cookie=(user_region)
Variant-Key: (gold europe)
Vary: Cookie
~~~
Expand Down