[3] [DFN[[CODE(HTTP)@en[[[Accept-Features:]]]]]] [[ヘッダー]]は、
対応している、あるいはしていない[[特徴]]を示すものです。

* 仕様書

[REFS[
- [1] [CITE@en[RFC 2295 - Transparent Content Negotiation in HTTP]] ([TIME[2014-08-31 19:36:42 +09:00]] 版) <http://tools.ietf.org/html/rfc2295#section-8.2>
]REFS]

* 意味

[11] [CODE(HTTP)@en[[[Accept-Features:]]]] [[ヘッダー]]は、
[[現在の要求の特徴集合]]にある[[特徴]]が存在するかしないかを示すものです [SRC[>>1]]。

* 構文

[4] [CODE(HTTP)@en[[[Accept-Features:]]]] [[ヘッダー]]の値は、
0個以上の値の[[リスト]] ([CODE(HTTP)[#]]) です [SRC[>>1]]。

[FIG(railroad)[
= ?
== 値
== *
=== [[OWS]]
=== [CODE(HTTP)[[[,]]]]
=== [[OWS]]
=== 値
]FIG]

[5] それぞれの値は[[特徴タグ]]などを使った式と、0個以上の[[引数]]です [SRC[>>1]]。

;; [6] 仕様書の時代的に構文上[[空白]]は明示されていませんが、
[CODE(HTTP)[[[;]]]] の前後に [[OWS]]、 [CODE(HTTP)[[[=]]]]
の前後に [[BWS]] が挿入されると推測されます。

[FIG(railroad)[
= 式
= *
== [[OWS]]
== [CODE(HTTP)[[[;]]]]
== [[OWS]]
== [[字句]]
== ?
=== [CODE(HTTP)[[[=]]]]
=== |
==== [[字句]]
==== [[引用文字列]]
]FIG]

[7] ただし[[引数]]は拡張用で未定義 [SRC[>>1]] とされています。

[13] 式は、[[特徴タグ]]か、 [CODE(HTTP)[[[!]]]] と[[特徴タグ]]か、
[[特徴タグ]]と値を [CODE(HTTP)[[[=]]]] または [CODE(HTTP)[[[!=]]]]
で連結したものか、 [[特徴タグ]]と [CODE(HTTP)[[[{]]]]...[CODE(HTTP)[[[}]]]]
で括った値を [CODE(HTTP)[[[=]]]] で連結したものか、 [CODE(HTTP)[[[*]]]]
のいずれかです。 [SRC[>>1]]

[FIG(railroad)[
= |
== =
=== ?
==== [CODE(HTTP)[[[!]]]]
=== [[特徴タグ]]
== =
=== [[特徴タグ]]
=== |
==== [CODE(HTTP)[[[=]]]]
==== [CODE(HTTP)[[[!=]]]]
=== 値
== =
=== [[特徴タグ]]
=== [CODE(HTTP)[[[=]]]]
=== [CODE(HTTP)[[[{]]]]
=== 値
=== [CODE(HTTP)[[[}]]]]
== [CODE(HTTP)[[[*]]]]
]FIG]

[14] [[特徴タグ]]のみの指定は、存在することを表します [SRC[>>1]]。

[15] [CODE(HTTP)[[[!]]]] は、その[[特徴タグ]]が存在しないことを表します [SRC[>>1]]。

[16] [CODE(HTTP)[[[=]]]] と値は、その[[特徴タグ]]と値が存在することを表します。
値が [CODE(HTTP)[[[{]]]]...[CODE(HTTP)[[[}]]]] で括られている場合は、
それ以外の値では存在しないことを表します。 [SRC[>>1]]

[17] [CODE(HTTP)[[[!=]]]] と値は、その[[特徴タグ]]が存在するものの、
その値ではないことを表します。 [SRC[>>1]]

[18] [CODE(HTTP)[[[*]]]] は、この[[ヘッダー]]で[[特徴集合]]すべてを説明しきっていないことを表します。
言及されていない[[特徴タグ]]が含まれるかもしれませんし、
[CODE(HTTP)[[[{]]]]...[CODE(HTTP)[[[}]]]] が使われていない[[特徴タグ]]には他の値があるかもしれません。 [SRC[>>1]]

* 文脈

[8] この[[ヘッダー]]は複数指定できます。

* 処理モデル

[12] [[鯖]]は[[遠隔異体選択アルゴリズム]]で使うことができます [SRC[>>1]]。

[19] この[[ヘッダー]]が存在しなければ、 [CODE(HTTP)[[[*]]]]
と指定されたのと等価です [SRC[>>1]]。

* 歴史

[FIG(quote)[
[FIGCAPTION[
[2] RFC 2295 (HTTP 透過内容折衝) 8.2 Accept-Features
]FIGCAPTION]

> The Accept-Features request header can be used by a user agent to
give information about the presence or absence of certain features in
the feature set of the current request.  Servers can use this
information when running a remote variant selection algorithm.

[CODE(HTTP)[Accept-Features]] 要求頭は、
[[利用者エージェント]]が現在の[[要求]]の[[特注集合]]中のある[[特徴]]があるかないかについての情報を与えるために使うことが出来ます。
[[サーバー]]は、[[遠隔変種選択算法]]を動作させる時にこの情報を使うことが出来ます。

> Note: the name `Accept-Features' for this header was chosen
because of symmetry considerations with other Accept- headers,
even though the Accept-Features header will generally not contain
an exhaustive list of features which are somehow `accepted'.  A
more accurate name of this header would have been `Feature-Set-Info'.

注意 : [CODE(HTTP)[Accept-Features]] というこの頭の名前は、
他の[[Accept‐頭]]との整合性のために選ばれましたが、
[CODE(HTTP)[Accept-Features]] 頭は通常はともかく「受け入れる」
特徴の完璧な目録を含みはしません。
この頭のもっと正確な名前は [CODE(HTTP)[Feature-Set-Info]]
辺りだったでしょう。

>
[PRE[
       Accept-Features = "Accept-Features" ":"
                   #( feature-expr *( ";" feature-extension ) )

       feature-expr = [ "!" ] ftag
                    | ftag ( "=" | "!=" ) tag-value
                    | ftag "=" "{" tag-value "}"
                    | "*"

       feature-extension = token [ "=" ( token | quoted-string ) ]
]PRE]

> No feature extensions are defined in this specification.  An example is:
[PRE[
       Accept-Features: blex, !blebber, colordepth={5}, !screenwidth,
                  paper = A4, paper!="A2", x-version=104, *
]PRE]

> The different feature expressions have the following meaning:
: ftag      : ftag is present
: !ftag     : ftag is absent
: ftag=V    : ftag is present with the value V
: ftag!=V   : ftag is present, but not with the value V
: ftag={V}  : ftag is present with the value V, and not with any other values
: *         : the expressions in this header do not fully describe the feature set: feature tags not mentioned in this header may also be present, and, except for the case ftag={V}, tags may be present with more values than mentioned.

各特徴式は次の意味を持ちます。
: [CODE(conneg)[ftag]]      : [VAR[ftag]] がある
: [CODE(conneg)[!ftag]]     : [VAR[ftag]] がない
: [CODE(conneg)[ftag=V]]    : [VAR[ftag]] は値 [VAR[V]] と共にある
: [CODE(conneg)[ftag!=V]]   : [VAR[ftag]] はあるが値 [VAR[V]] と共にはない
: [CODE(conneg)[ftag={V}]]  : [VAR[ftag]] は値 [VAR[V]] と共にあり、他のいかなる値とも共にはない
: [CODE(conneg)[*]]         : この頭の式は[[特徴集合]]を完全に記述していない。
この頭に示されていない[[特徴札]]はあるかもしれないし、
[CODE(conneg)[ftag={V}]] の場合を除き、示されている値以外もあるかもしれない。

> Absence of the Accept-Features header in a request is equivalent to the inclusion of
- [SAMP(HTTP)[Accept-Features: *]]

> By using the Accept-Features header, a remote variant selection
algorithm can sometimes determine the truth value of a feature
predicate on behalf of the user agent.  For example, with the header
[PRE[
       Accept-Features: blex, !blebber, colordepth={5}, !screenwidth,
                  paper = A4, paper!="A2", x-version=104, *
]PRE]
the algorithm can determine that the following predicates are true:
[PRE[
       blex, colordepth=[4-], colordepth!=6, colordepth, !screenwidth,
       paper=A4, colordepth=[4-6]
]PRE]
and that the following predicates are false:
[PRE[
       !blex, blebber, colordepth=6, colordepth=foo, !colordepth,
       screenwidth, screenwidth=640, screenwidth!=640,
]PRE]
but the truth value of the following predicates cannot be determined:
[PRE[
       UA-media=stationary, UA-media!=screen, paper!=a0,
       x-version=[100-300], x-version=[200-300], x-version=99,
       UA-media=screen, paper=A0, paper=a4, x-version=[100-199], wuxta
]PRE]
]FIG]

** RFC 4229

[10] [[RFC 4229]] は [[RFC 2295]] を出典に[[IANA登録簿]]に状態「[[実験的]]」で登録しています [SRC[>>9]]。

[REFS[
- [9] [CITE@en[RFC 4229 - HTTP Header Field Registrations]] ([TIME[2014-11-02 18:53:20 +09:00]] 版) <http://tools.ietf.org/html/rfc4229#section-2.1.6>
]REFS]

[20] [CITE@en[draft-ietf-fax-smtp-capabilities-00 - SMTP Service Extension for Capabilities Exchange]]
( ([TIME[2014-10-18 16:01:24 +09:00]] 版))
<https://tools.ietf.org/html/draft-ietf-fax-smtp-capabilities-00>