Skip to content

Commit

Permalink
Issue WICG#196 - Add a Sec-CH-UA-Version-List client hint
Browse files Browse the repository at this point in the history
  • Loading branch information
miketaylr committed Aug 11, 2021
1 parent 12b87f0 commit 3f9fa99
Showing 1 changed file with 50 additions and 7 deletions.
57 changes: 50 additions & 7 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,37 @@ The header's ABNF is:
Sec-CH-UA-Platform-Version = sf-string
```

The 'Sec-CH-UA-Version-List' Header Field {#sec-ch-ua-version-list}
--------------------------------

The <dfn http-header>`Sec-CH-UA-Version-List`</dfn> request header field gives a server information
about the [=user agent/full version=] for each brand in its [=brands=] list. It is a
[=Structured Header=] whose value MUST be a [=structured header/list=] [[!RFC8941]].

The header's ABNF is:

``` abnf
Sec-CH-UA-Version-List = sf-list
```

To <dfn abstract-op>return the `Sec-CH-UA-Version-List` value for a request</dfn>, [=user agents=]
MUST run the following steps:

1. Let |versionList| be a [=/list=], initially empty.
1. Let |brands| be the result of running the [=create brands=] steps, with
[=user agent/full version=] passed as an argument.
1. For each |brand| in |brands|:
1. Let |parameter| be a [=dictionary=], initially empty.
1. Set |parameter|["param_name"] to "v".
1. Set |parameter|["param_value"] to |brand|'s {{NavigatorUABrandVersion/version}}.
1. Let |pair| be a tuple comprised of |brand|'s {{NavigatorUABrandVersion/brand}} and
|parameter|.
1. Append |pair| to |versionList|.
1. Return the output of running [=serializing a list=] with |versionList| as input.

Note: These client hints can be evoked with the following set of [=client hints tokens=]:
`Sec-CH-UA`, `Sec-CH-UA-Arch`, `Sec-CH-UA-Bitness`, `Sec-CH-UA-Full-Version`, `Sec-CH-UA-Mobile`,
`Sec-CH-UA-Model`, `Sec-CH-UA-Platform`, `Sec-CH-UA-Platform-Version`

`Sec-CH-UA-Model`, `Sec-CH-UA-Platform`, `Sec-CH-UA-Platform-Version`, `Sec-CH-UA-Version-List`

Interface {#interface}
=================
Expand All @@ -669,12 +696,13 @@ dictionary NavigatorUABrandVersion {
dictionary UADataValues {
sequence&lt;NavigatorUABrandVersion&gt; brands;
boolean mobile;
DOMString platform;
DOMString architecture;
DOMString bitness;
DOMString model;
DOMString platform;
DOMString platformVersion;
DOMString uaFullVersion;
sequence&lt;NavigatorUABrandVersion&gt; versionList;
};

dictionary UALowEntropyJSON {
Expand Down Expand Up @@ -797,7 +825,6 @@ ISSUE(wicg/ua-client-hints): We can improve upon when and why a UA decides to re
3. Otherwise, run the following steps [=in parallel=]:

1. Let |uaData| be a new {{UADataValues}}.

1. set |uaData|["{{UADataValues/brands}}"] to [=this=]'s [=relevant global object=]'s [=WindowOrWorkerGlobalScope/brands frozen array=].
1. set |uaData|["{{UADataValues/mobile}}"] to the [=user agent=]'s [=user agent/mobileness=].
1. set |uaData|["{{UADataValues/platform}}"] to the [=user agent=]'s [=user agent/platform brand=].
Expand All @@ -811,6 +838,9 @@ ISSUE(wicg/ua-client-hints): We can improve upon when and why a UA decides to re
to the [=user agent=]'s [=user agent/platform version=].
1. If |hints| [=list/contains=] "uaFullVersion", let |uaData|["{{UADataValues/uaFullVersion}}"]
be the the user agent's [=user agent/full version=].
1. If |hints| [=list/contains=] "versionList", let |uaData|["{{UADataValues/versionList}}"]
be the result of running the [=create brands=] steps, with [=user agent/full version=]
passed as an argument.
1. [=Queue a task=] on the [=permission task source=] to [=resolve=] |p| with |uaData|.

4. Return |p|.
Expand Down Expand Up @@ -950,9 +980,9 @@ IANA Considerations {#iana}
===================

This document intends to define the `Sec-CH-UA`, `Sec-CH-UA-Arch`, `Sec-CH-UA-Bitness`,
`Sec-CH-UA-Full-Version`, `Sec-CH-UA-Mobile`, `Sec-CH-UA-Model`, `Sec-CH-UA-Platform`, and the
`Sec-CH-UA-Platform-Version` HTTP request header fields, and register them in the permanent message
header field registry ([[RFC3864]]).
`Sec-CH-UA-Full-Version`, `Sec-CH-UA-Mobile`, `Sec-CH-UA-Model`, `Sec-CH-UA-Platform`,
`Sec-CH-UA-Platform-Version`, and the `Sec-CH-UA-Version-List` HTTP request header fields, and
register them in the permanent message header field registry ([[RFC3864]]).

It also intends to deprecate usage of the `User-Agent` header field.

Expand Down Expand Up @@ -1060,6 +1090,19 @@ Author/Change controller: IETF

Specification document: this specification ([[#sec-ch-ua-platform-version]])

'Sec-CH-UA-Version-List' Header Field {#iana-version-list}
-------------------------

Header field name: Sec-CH-UA-Version-List

Applicable protocol: http

Status: standard

Author/Change controller: IETF

Specification document: this specification ([[#sec-ch-ua-version-list]])

'User-Agent' Header Field {#iana-user-agent}
-------------------------

Expand Down

0 comments on commit 3f9fa99

Please sign in to comment.