-
Notifications
You must be signed in to change notification settings - Fork 4
/
704.txt
161 lines (120 loc) · 12.4 KB
/
704.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
[221] [DFN[[CODE(HTTP)@en[[[OPTIONS]]]]]] [[メソッド]]は、[[対象資源]]の通信オプションについて問い合わせるものです。
* 仕様書
[REFS[
- [206] '''[CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-06-07 01:55:45 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-4.3.7>'''
- [202] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-06-07 01:55:45 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-4.2.1>
- [205] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-06-07 01:55:45 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-4.2.2>
]REFS]
* 意味
[207] [CODE(HTTP)@en[[[OPTIONS]]]] [[メソッド]]は、
[[起源鯖]]においてあるいは[[中間器]]においての[[対象資源]]についての通信オプションに関する情報を[[要求]]するものです
[SRC[>>206]]。
[208] これを使って[[クライアント]]は[[資源]]に関連付けられたオプションや要件や、[[鯖]]の能力について、
[[資源]]の動作を伴わずに判定することができます [SRC[>>206]]。
* 構文
[209] [[要求対象]]が [CODE[[[*]]]] の場合、特定の[[資源]]ではなく、
[[鯖]]一般に対して適用することを表します [SRC[>>206]]。
;; [210] ただし普通は[[鯖]]の通信オプションは[[資源]]に依存するものですから、
「[[ping]]」や「[[no-op]]」のようなもの、例えば [[HTTP/1.1]]
に適合するかどうかの試験などにしか有用ではありません [SRC[>>206]]。
[211] [[要求対象]]がそれ以外の場合、当該[[対象資源]]と通信する場合のオプションに適用することを表します
[SRC[>>206]]。
[215] [[クライアント]]は、[[要求鎖]]上の特定の[[受信者]]を対象とすべく
[CODE(HTTP)@en[[[Max-Forwards:]]]] [[ヘッダー]]を送信することができます [SRC[>>206]]。
[216] [[串]]は、 [CODE(HTTP)@en[[[Max-Forwards:]]]] を含む[[要求]]を[[転送]]する場合を除き、
これを[[生成]]しては[['''なりません''']] [SRC[>>206]]。
[217] [[要求]]の [[payload]] の利用方法は定義されていません [SRC[>>206]]。
;; [218] 将来の [[HTTP]] の拡張により、[[対象資源]]についてより詳細に[[照会]]するために使うかもしれない [SRC[>>206]]
とされています。
[219] [[要求]]に [[payload body]] を含める場合、 [CODE(HTTP)@en[[[Content-Type:]]]]
[[ヘッダー]]を[[生成]]しなければ[['''なりません''']] [SRC[>>206]]。
* 性質
[204] [CODE(HTTP)@en[[[OPTIONS]]]] は、[[安全なメソッド]] [SRC[>>202]] で、
[[冪等なメソッド]] [SRC[>>205]] です。
[220] [CODE(HTTP)@en[[[OPTIONS]]]] [[メソッド]]の[[要求]]に対する[[応答]]は、
[[キャッシュ可能]]ではありません [SRC[>>206]]。
* 処理モデル
[212] [[鯖]]は、成功の[[応答]]を帰す場合には、
[[鯖]]が実装していて[[対象資源]]に適用できるオプション機能を示す[[ヘッダー]]
(例えば [CODE(HTTP)@en[[[Allow:]]]]) を送信する[['''べきです''']]
[SRC[>>206]]。
[213] [[応答]]の [[payload]] がある場合は、
通信オプションを[[機械可読]]または[[人間可読]]な形の[[表現]]で記述したものかもしれません。
ただし [[HTTP]] としてはそのような標準の形式は定義していません。 [SRC[>>206]]
[214] [[鯖]]は、[[応答]]に [[payload body]] を含まない場合、
[CODE(HTTP)@en[[[Content-Length]]: 0]] を[[生成]]しなければ[['''なりません''']] [SRC[>>206]]。
* プロトコル切り替え
[2] [[RFC 2817]] は [[TLS]] への切り替えに [CODE(HTTP)@en[[[OPTIONS]]]] [[メソッド]]を使っています
[SRC[>>4]]。
;; [203] [CODE(HTTP)@en[[[Upgrade:]]]] [[ヘッダー]]も参照してください。
* 歴史
[REFS[
- [201] [[RFC 2068]]
- [3] [[RFC 2616]]
- [4] [CITE@en[RFC 2817 - Upgrading to TLS Within HTTP/1.1]] ([TIME[2012-01-09 20:05:09 +09:00]] 版) <http://tools.ietf.org/html/rfc2817#section-3.2>
]REFS]
[FIG(quote)[
[FIGCAPTION[
[1] RFC 2068・2616 (HTTP/1.1) 9.2 OPTIONS
]FIGCAPTION]
> The OPTIONS method represents a request for information about the
communication options available on the request/response chain
identified by the Request-URI. This method allows the client to
determine the options and/or requirements associated with a resource,
or the capabilities of a server, without implying a resource action
or initiating a resource retrieval.
[CODE(HTTP)[OPTIONS]] 方式は、 [CODE(ABNF)[[[Request-URI]]]]
で識別される要求・応答鎖で梨湯可能な通信選択肢についての情報を要求することを表現します。
この方式は、クライアントがある資源に関連付けられた選択肢[[及び/又は]]要件もしくはサーバーの能力を、
資源動作を課したり資源取り出しを初期化せずに決定することを可能とします。
> [DEL[Unless the server's response is an error, the response MUST NOT include entity information other than what can be considered as communication options (e.g., Allow is appropriate, but Content-Type is not).]]
Responses to this method are not cach[INS[e]]able.
;[DEL[サーバーの応答が[[誤り]]でない限り、応答は通信選択肢と考えることができるもの以外の[[実体]]情報を含めては'''なりません''' (例えば [CODE(HTTP)[[[Allow]]]] は適当ですが、 [CODE(HTTP)[[[Content-Type]]]] はそうではありません)。]]
この方式への応答は[[キャッシュ可能]]ではありません。
> If the OPTIONS request includes an entity-body (as indicated by the
presence of Content-Length or Transfer-Encoding), then the media type
MUST be indicated by a Content-Type field. Although this
specification does not define any use for such a body, future
extensions to HTTP might use the OPTIONS body to make more detailed
queries on the server. A server that does not support such an
extension MAY discard the request body.
[CODE(HTTP)[OPTION]] 要求が [CODE(ABNF)[[[entity-body]]]]
を含んでいる場合 ([CODE(HTTP)[[[Content-Length]]]] や [CODE(HTTP)[[[Transfer-Encoding]]]] の出現で示される。) は、
[CODE(HTTP)[Content-Type]] 欄で[[媒体型]]を示さなければ'''なりません'''。
この仕様書はこのような[[本体]]の使用を定義しませんが、
生来の HTTP no拡張はサーバーにより詳細に問い合わせするために
[CODE(HTTP)[OPTION]] 本体を使うかもしれません。
その拡張に対応していないサーバーは要求本体を捨てても'''構いません'''。
> If the Request-URI is an asterisk ("*"), the OPTIONS request is
intended to apply to the server [DEL[as a whole]] [INS[in general rather than to a specific resource]]. [DEL[A 200 response SHOULD include any header fields which indicate optional features implemented by the server (e.g., Public), including any extensions not defined by this specification, in addition to any applicable general or response-header fields. As described in section 5.1.2, an "OPTIONS *" request can be applied through a proxy by specifying the destination server in the Request-URI without any path information.]] [INS[Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof).]]
[CODE(ABNF)[[[Request-URI]]]] が星印 ([CODE(HTTP)[*]])
であるなら、その [CODE(HTTP)[OPTION]] 要求は特定の資源にではなくそのサーバー一般に適用することを意図しています。[DEL[[CODE(HTTP)[[[200]]]] 応答は、応用可能な一般・要求頭欄に加えて、この仕様書で定義されていない拡張を含むサーバーが実装している任意選択機能を示す頭欄 (例えば [CODE(HTTP)[[[Public]]]]) を含める'''べきです'''。5.1.2 節で説明したように、 [CODE(HTTP)[OPTIONS *]] 要求は終点サーバーを経路情報なしの [CODE(ABNF)[Request-URI]] に指定することで[[串]]を通じて適用できます。]] [INS[サーバーの通信選択肢は典型的に資源に依存しますから、 [CODE(HTTP)[*]] 要求は「ping」や「no‐op」のような型の方式にのみ有用です。クライアントがサーバーの能力を検査できる以上のことは何もできません。例えば、これは串が HTTP/1.1 に適合していること (やしていないこと) を検査するのに使えます。]]
> If the Request-URI is not an asterisk, the OPTIONS request applies
only to the options that are available when communicating with that resource.
[CODE(ABNF)[Request-URI]] が星印ではないときは、 [CODE(HTTP)[OPTIONS]]
要求は要求で通信した時に利用可能な選択肢のみに適用されます。
> A 200 response SHOULD include any header fields that indicate
optional features implemented by the server and applicable to that resource (e.g., Allow), [INS[possibly]] including [DEL[any]] extensions not defined by this specification[DEL[, in addition to any applicable general or response-header fields]]. [DEL[If the OPTIONS request passes through a proxy, the proxy MUST edit the response to exclude those options which apply to a proxy's capabilities and which are known to be unavailable through that proxy.]] [INS[The response body, if any, SHOULD also include information about the communication options. The format for such a body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY be used to select the appropriate response format. If no response body is included, the response MUST include a Content-Length field with a field-value of "0".]]
[CODE(HTTP)[200]] 応用は、サーバーが実装していてその資源に適用可能な任意選択機能を示す頭欄 (例えば [CODE(HTTP)[[[Allow]]]]) を含める'''べきです'''。
それはこの仕様書で定義していない拡張を含むかもしれません。 [DEL[[CODE(HTTP)[OPTIONS]] 要求が串を通じて渡される時は、串は応答を編集して、串の能力に適用できて串を通じては利用可能でないとわかっている選択肢を除外しなければ'''なりません'''。]] [INS[応答本体がある場合は、通信選択肢についての情報も含む'''べきです'''。その本体の書式はこの仕様書では定義しませんが、生来の HTTP の拡張が定義するかもしれません。適切な応答書式を選択するのに[[内容折衝]]を使っても'''構いません'''。応答本体が含まれていない時は、欄値が [CODE(HTTP)[0]] の [CODE(HTTP)[Content-Length]] 欄を含めなければ'''なりません'''。]]
[INS[
> The Max-Forwards request-header field MAY be used to target a
specific proxy in the request chain. When a proxy receives an OPTIONS
request on an absoluteURI for which request forwarding is permitted,
the proxy MUST check for a Max-Forwards field. If the Max-Forwards
field-value is zero ("0"), the proxy MUST NOT forward the message;
instead, the proxy SHOULD respond with its own communication options.
If the Max-Forwards field-value is an integer greater than zero, the
proxy MUST decrement the field-value when it forwards the request. If
no Max-Forwards field is present in the request, then the forwarded
request MUST NOT include a Max-Forwards field.
[CODE(HTTP)[[[Max-Forwards]]]] 要求頭欄を、[[要求鎖]]の中の特定の串を対象とするのに使っても'''構いません'''。
串が、転送が認められている [CODE(ABNF)[[[absoluteURI]]]] についての [CODE(HTTP)[OPTIONS]]
要求を受取った時は、串は [CODE(HTTP)[Max-Forwards]] 欄を確認しなければ'''なりません'''。
[CODE(HTTP)[Max-Forwards]] 欄値が零 ([CODE(HTTP)[0]]) なら、
串は[[メッセージ]]を転送しては'''なりません'''。
代わりに、串は自身の通信選択肢で応答する'''べきです'''。
その要求に [CODE(HTTP)[Max-Forwards]] 欄がなければ、
転送する要求は [CODE(HTTP)[Max-Forwards]] 欄を含んでは'''なりません'''。
]INS]
]FIG]