[23] [DFN[[CODE(HTTP)@en[[[TCN:]]]]]] [[ヘッダー]]は、[[透過内容折衝]]の[[応答]]であることとその種別を示します。

* 仕様書

[REFS[
- [4] '''[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.5>'''
- [22] [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-10>
]REFS]

* 意味

[6] [CODE(HTTP)@en[[[TCN:]]]] [[ヘッダー]]は[[透過的折衝可能資源]]であることを示すものです
[SRC[>>4]]。

* 構文

[7] [CODE(HTTP)@en[[[TCN:]]]] [[ヘッダー]]の値は0個以上の値の[[リスト]]
([CODE(HTTP)[#]]) です [SRC[>>4]]。

[FIG(railroad)[
= ?
== 値
== *
=== [[OWS]]
=== [CODE(HTTP)[[[,]]]]
=== [[OWS]]
=== 値
]FIG]

[8] 値は[[字句]]か、[[字句]]と [CODE(HTTP)[[[=]]]] と[[字句]]または[[引用文字列]]を連ねたものです [SRC[>>4]]。

[FIG(railroad)[
= [[字句]]
= ?
== [CODE(HTTP)[[[=]]]]
== |
=== [[字句]]
=== [[引用文字列]]
]FIG]

;; [9] 値の一部は[[指令]]と呼ばれていますが、すべてでは無いようです。

;; [11] 値の解釈は明記されていませんが、定義されているものは構文上[[大文字・小文字不区別]]となっています。
指定の順序に意味は無いものと推測されます。

* 文脈

[13] [[透過的折衝可能資源]]以外は [CODE(HTTP)@en[[[TCN:]]]] [[ヘッダー]]を含めては[['''なりません''']] [SRC[>>4]]。

[14] [[透過的折衝可能資源]]では、 [CODE(HTTP)[[[2xx]]]] と [CODE(HTTP)[[[3xx]]]]
の[[応答]]には [CODE(HTTP)@en[[[TCN:]]]] [[ヘッダー]]と
[CODE(HTTP)@en[[[list]]]]、[CODE(HTTP)@en[[[choice]]]]、[CODE(HTTP)@en[[[adhoc]]]]
のいずれかを含めなければ[['''なりません''']] [SRC[>>4, >>22]]。ただし
[CODE(HTTP)[[[304]]]] には含めても含めなくても構いません [SRC[>>4, >>22]]。

[15] [[透過的折衝可能資源]]の他の[[応答]]には、 >>14 の3つの値以外の
[CODE(HTTP)@en[[[TCN:]]]] [[ヘッダー]]を含めて構いません [SRC[>>4, >>22]]。

[16] [[起源鯖]]が[[鯖側上書き]]を行った時は [CODE(HTTP)@en[[[re-choose]]]]
または [CODE(HTTP)@en[[[keep]]]] を含めなければ[['''なりません''']] [SRC[>>4]]。

[17] [CODE(HTTP)@en[[[re-choose]]]] を含めた場合は [CODE(HTTP)@en[[[Alternates:]]]]
[[ヘッダー]]を含めなければ[['''なりません''']] [SRC[>>4]]。

[21] この[[ヘッダー]]は複数指定できます。

* 値

[10] 値 ([[指令]]など) としては次のものがあります。
[FIG(railroad)[
- [CODE(HTTP)@en[[[list]]]]
- [CODE(HTTP)@en[[[choice]]]]
- [CODE(HTTP)@en[[[adhoc]]]]
- [CODE(HTTP)@en[[[re-choose]]]]
- [CODE(HTTP)@en[[[keep]]]]
]FIG]

[12] [[IANA登録簿]]は特に用意されていないようです。

[20] [[クライアント]]は認識できない値を無視する[['''べきです''']] [SRC[>>4]]。

* 処理モデル

[18] [[利用者エージェント]]は、[[応答]]に [CODE(HTTP)@en[[[re-choose]]]] と 
[CODE(HTTP)@en[[[Alternates:]]]] が含まれている時は、[[内部変種選択アルゴリズム]]によって再選択する[['''べきです''']] [SRC[>>4]]。

[19] [[利用者エージェント]]は、[[応答]]に [CODE(HTTP)@en[[[keep]]]] 
が含まれている時は、再折衝する[['''べきではなく''']]、
直接表示するか、[[リダイレクト]]なら直接処理する[['''べきです''']]。

* 歴史

[FIG(quote)[
[FIGCAPTION[
[5] RFC 2295 (HTTP 透過内容折衝) 8.5 TCN
]FIGCAPTION]

> The TCN response header is used by a server to signal that the
resource is transparently negotiated.

>
[PRE[
       TCN = "TCN" ":" #( response-type
                        | server-side-override-directive
                        | tcn-extension )
       response-type = "list" | "choice" | "adhoc"
       server-side-override-directive = "re-choose" | "keep"
       tcn-extension = token [ "=" ( token | quoted-string ) ]
]PRE]

> If the resource is not transparently negotiated, a TCN header MUST
NOT be included in any response.  If the resource is transparently
negotiated, a TCN header, which includes the response-type value of
the response, MUST be included in every response with a 2xx status
code or any 3xx status code, except 304, in which it MAY be included.
A TCN header MAY also be included, without a response-type value, in
other responses from transparently negotiated resources.

> A server-side override directive MUST be included if the origin
server performed a server-side override when choosing the response.
If the directive is "re-choose", the server MUST include an
Alternates header with the variant bound to the negotiable resource
in the response, and user agent SHOULD use its internal variant
selection algorithm to choose, retrieve, and display the best variant
from this list.  If the directive is "keep" the user agent SHOULD NOT
renegotiate on the response, but display it directly, or act on it
directly if it is a redirection response.

> Clients SHOULD ignore all tcn-extensions they do not understand.
]FIG]

** RFC 4229

[3] [[RFC 4229]] は [[RFC 2295]] を出典に[[IANA登録簿]]に状態「[[実験的]]」で登録しています [SRC[>>1]]。

[REFS[
- [1] [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.103>
]REFS]

* メモ

[2] [CITE[Apache HTTP Server Project]]
( ([TIME[2011-05-28 00:58:55 +09:00]] 版))
<http://httpd.apache.org/docs/1.3/misc/known_client_problems.html#lynx-negotiate-trans>