1. 序論
HTTP は、概して,分散型の情報システム用に利用され、そこでの処理能は,応答キャッシュの利用により改善し得る。 この文書は、 HTTP/1.1 に関係する,応答メッセージのキャッシュ処理と再利用の側面を定義する。 HTTP is typically used for distributed information systems, where performance can be improved by the use of response caches. This document defines aspects of HTTP/1.1 related to caching and reusing response messages.
HTTP キャッシュ は、応答メッセージの局所的な格納域であり,その中に格納されるメッセージたちの[ ストレージ, 検索取得, 削除 ]を制御する下位システムである。 キャッシュは、未来の等価な要請に対する[ 応答時間やネットワーク帯域幅の消費量 ]を抑制するために,キャッシュ可能な応答を格納する。 どのクライアント/サーバもキャッシュを使役してよい — トンネルとして動作するサーバは,キャッシュを利用できないが。 An HTTP cache is a local store of response messages and the subsystem that controls storage, retrieval, and deletion of messages in it. A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server MAY employ a cache, though a cache cannot be used by a server that is acting as a tunnel.
共用キャッシュ は,複数の利用者により再利用されるような応答を格納するキャッシュである — それは、(常にではないが)通例的に,媒介者の一部分として配備される。 対照的に, 私用キャッシュ は、単独の利用者ごとに専用であり,UA のコンポーネントとして配備されることが多い。 A shared cache is a cache that stores responses to be reused by more than one user; shared caches are usually (but not always) deployed as a part of an intermediary. A private cache, in contrast, is dedicated to a single user; often, they are deployed as a component of a user agent.
HTTP/1.1 におけるキャッシュ処理の目標は、先立つ応答メッセージを再利用して,現在の要請を満たすことにより、処理能を有意に改善することである。 【†キャッシュに】格納済みな応答は — § 4.2 にて定義されるように — 応答が 検証( 生成元サーバによる[ この要請用のキャッシュ済み応答が有効であり続ける ]かどうかの検査 )を伴わずに再利用できるとき,新鮮であると見なされる。 したがって,新鮮な応答は、再利用されるごとに 遅延とネットワークオーバーヘッド の両者を抑制し得る。 キャッシュ済み応答が新鮮でないときでも,[ 検証により新鮮化できる, または 生成元サーバが可用でない(§ 4.2.4 ) ]ときは、依然として再利用できることもある。 The goal of caching in HTTP/1.1 is to significantly improve performance by reusing a prior response message to satisfy a current request. A stored response is considered "fresh", as defined in Section 4.2, if the response can be reused without "validation" (checking with the origin server to see if the cached response remains valid for this request). A fresh response can therefore reduce both latency and network overhead each time it is reused. When a cached response is not fresh, it might still be reusable if it can be freshened by validation (Section 4.3) or if the origin is unavailable (Section 4.2.4).
【† この仕様の語 “格納済み( stored )” は、 “キャッシュに格納済み” の略記として用いられている。 “キャッシュ済み( cached )” も同義と見られる。 】
1.1. 適合性, エラーの取り扱い
この文書内のキーワード "MUST" … 【以下、この段落の内容は IETF 日本語訳 共通ページに移譲。】 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
適合性の判定基準, および エラーの取り扱いに関する考慮点は、 [RFC7230] § 2.5 にて定義される。 Conformance criteria and considerations regarding error handling are defined in Section 2.5 of [RFC7230].
1.2. 構文の表記法
【 この節の他の内容は、 HTTP 日本語訳 共通ページに移譲。 】
総集的 ABNF にて、他の文書から取り込まれた規則, および すべてのリスト演算子を標準な ABNF 表記法に展開した,総集的な文法を示す。 This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC5234] with a list extension, defined in Section 7 of [RFC7230], that allows for compact definition of comma-separated lists using a '#' operator (similar to how the '*' operator indicates repetition). Appendix B describes rules imported from other documents. Appendix C shows the collected grammar with all list operators expanded to standard ABNF notation.
1.2.1. delta 秒
delta-seconds 規則は、秒数を表現する,負でない整数を指定する。
The delta-seconds rule specifies a non-negative integer, representing time in seconds.
delta-seconds= 1*DIGIT
受信者は、[
delta-seconds 値を構文解析してバイナリ形に変換する
]際には,[
少なくとも 31ビット以上, かつ負でない整数の範囲をとる,算術型
]を利用するべき.である。
delta-seconds 値を受信したキャッシュは、その値が[
自身が表現できる最大な整数より大きい, または
自身による後続の計算にて桁溢れする
]場合には,[
2147483648( 2 の 31 乗), または
都合よく表現できる最大な正な整数
]と見なさなければならない。
A recipient parsing a delta-seconds value and converting it to binary form ought to use an arithmetic type of at least 31 bits of non-negative integer range. If a cache receives a delta-seconds value greater than the greatest integer it can represent, or if any of its subsequent calculations overflows, the cache MUST consider the value to be either 2147483648 (2^31) or the greatest positive integer it can conveniently represent.
注記: ここでの値 2147483648 は、歴史的な理由による — それは実質的に無限( 68 年以上)を表現する。 この値はバイナリ形として格納される必要はない — 実装は、[ その数を直に表現できないような算術型により計算が遂行される ]ときでも、桁溢れが生じた場合には,canned 文字列†として生産できる。 ここで問われるのは、 桁溢れが検出され,今後の計算において負な値に扱われないことである。 【† 単に,その数を表現する文字列? または、ある上限整数を表現する定義済み文字列?】 Note: The value 2147483648 is here for historical reasons, effectively represents infinity (over 68 years), and does not need to be stored in binary form; an implementation could produce it as a canned string if any overflow occurs, even if the calculations are performed with an arithmetic type incapable of directly representing that number. What matters here is that an overflow be detected and not treated as a negative value in later calculations.
2. キャッシュ運用の概観
キャッシュを適正に運用することで、 HTTP 転送( [RFC7231] )の意味論を保全しつつ,すでにキャッシュ内に保持されている情報については転送しなくて済むようになる。 HTTP におけるキャッシュ処理は,全面的に任意選択の特能であるが、[ キャッシュ済み応答の再利用は望ましいものであり、そのような再利用は,それを防止するような[ 要件や局所的な環境設定 ]が無ければ,既定のふるまいである ]ものと見做せる。 したがって,HTTP キャッシュに課される要件は、キャッシュに対し,[ 常に,ある特定の応答を格納して再利用する ]ことを義務付けるのではなく,[[ 再利用できない応答の格納法 / 格納済み応答の不適切な再利用 ]を防止する ]ことに力点が置かれる。 Proper cache operation preserves the semantics of HTTP transfers ([RFC7231]) while eliminating the transfer of information already held in the cache. Although caching is an entirely OPTIONAL feature of HTTP, it can be assumed that reusing a cached response is desirable and that such reuse is the default behavior when no requirement or local configuration prevents it. Therefore, HTTP cache requirements are focused on preventing a cache from either storing a non-reusable response or reusing a stored response inappropriately, rather than mandating that caches always store and reuse particular responses.
各キャッシュエントリは、
キャッシュキー,
および 1 個以上の[
先立つ要請に対応する HTTP 応答であって,同じキーを利用するもの
]からなる。
キャッシュエントリに最もよくある形は、検索取得要請に対する成功裡な結果である:
すなわち,
GET 要請に対する 200 (OK) 応答であって,要請ターゲットにより識別されたリソースの表現を包含するものである。
しかしながら,[
恒久的リダイレクト【 301 (Moved Permanently) 】,
否定的な結果(例: 404 (Not Found) ),
不完全
【または部分的】
な結果(例: 206 (Partial Content) ),
GET 以外のメソッドに対する応答
]も,そのメソッドの定義により[
そのようなキャッシュ処理が許容されていて, かつ
キャッシュキーとして利用するに相応しい何かが定義されている
]ならば、キャッシュすることは可能である。
Each cache entry consists of a cache key and one or more HTTP responses corresponding to prior requests that used the same key. The most common form of cache entry is a successful result of a retrieval request: i.e., a 200 (OK) response to a GET request, which contains a representation of the resource identified by the request target (Section 4.3.1 of [RFC7231]). However, it is also possible to cache permanent redirects, negative results (e.g., 404 (Not Found)), incomplete results (e.g., 206 (Partial Content)), and responses to methods other than GET if the method's definition allows such caching and defines something suitable for use as a cache key.
主たるキャッシュキーは、要請メソッドとターゲット URI からなる。
しかしながら,今日における HTTP キャッシュによくある利用では、概して, GET に対する応答のキャッシュ処理に制限されるので、多くのキャッシュは,他のメソッドを単純に拒み,URI のみを主たるキャッシュキーとして利用している。
The primary cache key consists of the request method and target URI. However, since HTTP caches in common use today are typically limited to caching responses to GET, many caches simply decline other methods and use only the URI as the primary cache key.
要請ターゲットが,内容折衝の対象である場合、そのキャッシュエントリは,複数の格納済み応答からなることもある — それぞれが,元の要請の選定用ヘッダたちの値による副次的キー( § 4.1 )により,区別されるような。 If a request target is subject to content negotiation, its cache entry might consist of multiple stored responses, each differentiated by a secondary key for the values of the original request's selecting header fields (Section 4.1).
3. キャッシュ内への応答の格納法
キャッシュがある要請に対する応答を格納し得るのは、次のいずれも満たされる場合に限られる — 他の応答は格納してはならない: A cache MUST NOT store a response to any request, unless:
- キャッシュは、要請メソッドを解する。† ↓
- 要請メソッドは、キャッシュ可能であるものと定義されている。 • The request method is understood by the cache and defined as being cacheable, and
- キャッシュは、応答状態°コードを解する。† • the response status code is understood by the cache, and
-
要請ヘッダに,
no-storeキャッシュ指令は現れていない。 ↓ -
応答ヘッダに,
no-storeキャッシュ指令は現れていない。 • the "no-store" cache directive (see Section 5.2) does not appear in request or response header fields, and -
キャッシュは共用キャッシュでないか, または[ 共用キャッシュであって,次のいずれも満たされる ]: ↓
-
応答内に
private応答指令は現れていない。 • the "private" response directive (see Section 5.2.2.6) does not appear in the response, if the cache is shared, and -
要請内に
Authorizationヘッダは現れていない — ただし、応答により明示的に格納が許容されている場合を除く(§ 3.2 を見よ)。 • the Authorization header field (see Section 4.2 of [RFC7235]) does not appear in the request, if the cache is shared, unless the response explicitly allows it (see Section 3.2), and
-
応答内に
-
応答は、次のいずれかを満たす: • the response either:
-
Expiresヘッダを包含している。 * contains an Expires header field (see Section 5.3), or -
max-age応答指令を包含している。 * contains a max-age response directive (see Section 5.2.2.8), or -
s-maxage応答指令を包含している, かつ キャッシュは共有されている。 * contains a s-maxage response directive (see Section 5.2.2.9) and the cache is shared, or - [ キャッシュされることを許容する,キャッシュ制御拡張 ]を包含している。 * contains a Cache Control Extension (see Section 5.2.3) that allows it to be cached, or
- 状態°コードにより,既定でキャッシュ可能であるものと定義されている(§ 4.2.2 を見よ)。 * has a status code that is defined as cacheable by default (see Section 4.2.2), or
-
public応答指令を包含している。 * contains a public response directive (see Section 5.2.2.5).
-
注記: 上に挙げた,どの要件も,キャッシュ制御拡張により上書きされ得る。 Note that any of the requirements listed above can be overridden by a cache-control extension; see Section 5.2.3.
† この文脈においては、キャッシュは,[ 要請メソッド/応答状態°コード を認識した上で,[ 指定された,キャッシュ処理に関係するふるまい ]すべてを実装する ]ならば、それを “解する” とされる。 In this context, a cache has "understood" a request method or a response status code if it recognizes it and implements all specified caching-related behavior.
注記: 通常の運用においては、一部のキャッシュは,キャッシュ検証子も明示的な失効時刻も持たないような応答を,格納しない — そのような応答は、通例的に,格納しても有用にならないので。 しかしながら、キャッシュがそのような応答を格納することも,禁制されない。 Note that, in normal operation, some caches will not store a response that has neither a cache validator nor an explicit expiration time, as such responses are not usually useful to store. However, caches are not prohibited from storing such responses.
3.1. 不完全な応答の格納法
応答メッセージは[ 接続が close されるに先立って,メッセージフレーム法([RFC7230])により指示される すべてのオクテットが受信された ]とき,完全であると見なされる。 A response message is considered complete when all of the octets indicated by the message framing ([RFC7230]) are received prior to the connection being closed.\
キャッシュは: ↓
-
[
要請メソッドは
GET, かつ 応答状態°コードは200(OK), かつ 応答のヘッダ節については全体が受信された ]場合、その応答を — その不完全なメッセージ本体を不完全であると記録した上で — キャッシュに格納してよい。 同様に,206(Partial Content) 応答についても、それが不完全な200(OK) 応答であったかのように格納してよい。 If the request method is GET, the response status code is 200 (OK), and the entire response header section has been received, a cache MAY store an incomplete response message body if the cache entry is recorded as incomplete. Likewise, a 206 (Partial Content) response MAY be stored as if it were an incomplete 200 (OK) cache entry.\ -
しかしながら,[[
Range,Content-Range]ヘッダをサポートしない ]または[ それらのヘッダに利用された範囲単位を解さない ]ならば、内容が[ 不完全, または部分的 ]な応答を格納してはならない。 However, a cache MUST NOT store incomplete or partial-content responses if it does not support the Range and Content-Range header fields or if it does not understand the range units used in those fields. - 不完全な格納済み応答を、[ 後続の範囲要請を為すことにより得られた成功裡な応答 ]を[ § 3.3 にて定義されるように,格納済みなエントリたちと結合する ]ことにより,完全にしてよい。 A cache MAY complete a stored incomplete response by making a subsequent range request ([RFC7233]) and combining the successful response with the stored entry, as defined in Section 3.3.\
- 次が満たされない限り、不完全な応答を,要請に対する回答として利用してはならない :[ 応答は【前項のように】完全に作り上げられた ]か,または[ 要請は部分的要請であって,[ 不完全な応答の中に全体が収まるような範囲 ]を指定している ] A cache MUST NOT use an incomplete response to answer requests unless the response has been made complete or the request is partial and specifies a range that is wholly within the incomplete response.\
-
部分的応答をクライアントに送信するときは、状態°コード
206(Partial Content) を利用するなどにより,明示的にそうであるものとマークしなければならない。 A cache MUST NOT send a partial response to a client without explicitly marking it as such using the 206 (Partial Content) status code.
3.2. 認証済み要請に対する応答の格納法
共用キャッシュは、[
Authorization ヘッダを伴う要請に対するキャッシュ済み応答
]を利用して,後続の要請を満たしてはならない
— ただし、応答内に[
そのような応答を格納することを許容するキャッシュ指令
]が在る場合は除く。
A shared cache MUST NOT use a cached response to a request with an Authorization header field (Section 4.2 of [RFC7235]) to satisfy any subsequent request unless a cache directive that allows such responses to be stored is present in the response.
この仕様においては、次の Cache-Control 応答指令が,そのような効果を持つ:
must-revalidate,
public,
s-maxage 。
In this specification, the following Cache-Control response directives (Section 5.2.2) have such an effect: must-revalidate, public, and s-maxage.
注記:
共用キャッシュが、[[
must-revalidate や s-maxage 応答指令を包含する
], かつ[
非新鮮である
]ような,キャッシュ済み応答
]をサーブする(§ 4.2.4 )ことは許容されない。
特に,[[
"max-age=0, must-revalidate"
], あるいは
"s-maxage=0"
]を伴う応答を、生成元サーバによる再検証を伴わずに,後続の要請を満たすために利用することはできない。
Note that cached responses that contain the "must-revalidate" and/or "s-maxage" response directives are not allowed to be served stale (Section 4.2.4) by shared caches. In particular, a response with either "max-age=0, must-revalidate" or "s-maxage=0" cannot be used to satisfy a subsequent request without revalidating it on the origin server.
3.3. 部分的内容の結合法
応答は、接続が尚早に close された, または
要請が 1 個以上の Range 指定子を利用した場合に、部分的な表現のみを転送することがある。
そのような転送が何度か行われたとき、キャッシュは,同じ表現のいくつかの範囲を受信し得る。
キャッシュは、これらの範囲を,[
それらすべてが同じ強い検証子を共有する, かつ
キャッシュが [RFC7233] § 4.3 によるクライアント要件に準拠する
]ならば、単独の格納済み応答に結合して,その応答を今後の要請を満たすために再利用してよい。
A response might transfer only a partial representation if the connection closed prematurely or if the request used one or more Range specifiers ([RFC7233]). After several such transfers, a cache might have received several ranges of the same representation. A cache MAY combine these ranges into a single stored response, and reuse that response to satisfy later requests, if they all share the same strong validator and the cache complies with the client requirements in Section 4.3 of [RFC7233].
キャッシュは、新たな応答と, 1 個以上の格納済み応答とを結合するときは,次をしなければならない: When combining the new response with one or more stored responses, a cache MUST:
-
格納済み応答内の[
warn-code1xxを伴うWarningヘッダ ]は,すべて削除する。 • delete any Warning header fields in the stored response with warn-code 1xx (see Section 5.5); -
格納済み応答内の[
warn-code2xxを伴うWarningヘッダ ]は,すべて維持する。 • retain any Warning header fields in the stored response with warn-code 2xx; and, -
新たな応答内に供された,他のヘッダ
— ただし,
Content-Rangeは除く — を用いて、[ 格納済み応答内の対応するヘッダすべてのインスタンス ]を代用する。 • use other header fields provided in the new response, aside from Content-Range, to replace all instances of the corresponding header fields in the stored response.
4. キャッシュからの応答の構築法
受信された 要請 に対し、キャッシュが,自身に格納済みな応答(以下,単に 応答 )を再利用できるためには、次のすべてが満たされなければならない: When presented with a request, a cache MUST NOT reuse a stored response, unless:
- 応答 の 実効要請 URI と, 要請 に提示されたそれが合致する。 • The presented effective request URI (Section 5.5 of [RFC7230]) and that of the stored response match, and
- 応答 に結び付けられた要請メソッドは、 応答 を 要請 用に利用することを許容している。 • the request method associated with the stored response allows it to be used for the presented request, and
- 応答 に挙げられた どの選定用ヘッダ(もしあれば)も, 要請 に提示されたそれに合致する(§ 4.1 を見よ) • selecting header fields nominated by the stored response (if any) match those presented (see Section 4.1), and
-
応答 は成功裡に検証されている, または 次のいずれも満たされる:
-
要請 は、
no-cachePragmaもno-cacheキャッシュ指令も包含しない。 • the presented request does not contain the no-cache pragma (Section 5.4), nor the no-cache cache directive (Section 5.2.1), unless the stored response is successfully validated (Section 4.3), and -
応答 は、
no-cache応答キャッシュ指令を包含しない。 • the stored response does not contain the no-cache cache directive (Section 5.2.2.2), unless it is successfully validated (Section 4.3), and
-
要請 は、
-
応答 は、次のいずれかを満たす: • the stored response is either:
注記: 上に挙げた,どの要件も,キャッシュ制御拡張により上書きされ得る。 Note that any of the requirements listed above can be overridden by a cache-control extension; see Section 5.2.3.
キャッシュは:
-
検証を伴わない要請を満たすために,格納済み応答を利用するときには、[
格納済み応答の 現在齢 に等しい値にされた
Ageヘッダ ]を,応答内に生成しなければならない — 応答内にそのヘッダが在るならそれを代用して。 When a stored response is used to satisfy a request without validation, a cache MUST generate an Age header field (Section 5.1), replacing any present in the response with a value equal to the stored response's current_age; see Section 4.2.3. -
安全でないメソッドを伴う要請に対しては、生成元サーバに向けて,そのまま書き出さなければならない — すなわち,キャッシュには、[ 要請が回送されて, 対応する応答が受信される ]までは、そのような要請に対する返信を生成することは,許容されない。 A cache MUST write through requests with methods that are unsafe (Section 4.2.1 of [RFC7231]) to the origin server; i.e., a cache is not allowed to generate a reply to such a request before having forwarded the request and having received a corresponding response.
注記: 安全でない要請は、すでに格納済みな応答を無効化し得る — § 4.4 を見よ。 Also, note that unsafe requests might invalidate already-stored responses; see Section 4.4.
-
相応しい格納済み応答が複数あるときは、(
Dateヘッダにより決定される)最も近過去の応答を利用しなければならない。 また、要請に "Cache-Control: max-age=0", あるいは "Cache-Control: no-cache" を伴わせた上で,回送して、利用する応答を一義化できる。 When more than one suitable response is stored, a cache MUST use the most recent response (as determined by the Date header field). It can also forward the request with "Cache-Control: max-age=0" or "Cache-Control: no-cache" to disambiguate which response to use. - 時計が可用でないときは、格納済み応答を,再検証することなく利用してはならない — どの利用においても。 A cache that does not have a clock available MUST NOT use stored responses without revalidating them upon every use.
4.1. Vary による副次的キーの計算
キャッシュが[
格納済み応答により満たせるような,要請
]を受信したとき,その応答が Vary ヘッダを持つ場合には、[
そのヘッダ値に挙げられた,すべての選定用ヘッダ
]について,[
元の要請(すなわち,格納済み応答に結び付けられているもの)と
今の要請が,以下に述べるように合致する
]場合を除き、その応答を利用してはならない:
When a cache receives a request that can be satisfied by a stored response that has a Vary header field (Section 7.1.4 of [RFC7231]), it MUST NOT use that response unless all of the selecting header fields nominated by the Vary header field match in both the original request (i.e., that associated with the stored response), and the presented request.
-
所与の選定用ヘッダに対し, 2 つの要請のそれが互いに合致するための必要十分条件は、[ それぞれの要請に,次に挙げるいくつかを適用することにより、一方の要請のヘッダ値を他方のそれに変形できるとき ]と定義される: The selecting header fields from two requests are defined to match if and only if those in the first request can be transformed to those in the second request by applying any of the following:
- ヘッダの構文にて許容される所で,空白を追加する/除去する。 • adding or removing whitespace, where allowed in the header field's syntax
- 同じヘッダ名の,複数のヘッダを結合する( [RFC7230] § 3.2 を見よ)。 • combining multiple header fields with the same field name (see Section 3.2 of [RFC7230])
- 両ヘッダ値を、[ ヘッダの仕様に則って,意味論が一致することが既知である ]ような仕方で正規化する(例:[ 順序が有意でない所では,ヘッダ値を並び替える ], [ 文字大小無視と定義されている所では,小文字(または大文字)のみに正規化する ], 等々)。 • normalizing both header field values in a way that is known to have identical semantics, according to the header field's specification (e.g., reordering field values when order is not significant; case-normalization, where values are defined to be case-insensitive)
- (正規化を終えた後に,)対象のヘッダが片方の要請のみに在る場合は、合致しないものとする。 If (after any normalization that might take place) a header field is absent from a request, it can only match another request if it is also absent there.
-
Varyヘッダ値 "*" は、常に合致しない。 【他方のそれも "*" であっても】 A Vary header field-value of "*" always fails to match.
格納済み応答のうち,すべての選定用ヘッダについて合致するものは、 被選定応答 と呼ばれる。 The stored response with matching selecting header fields is known as the selected response.
複数の被選定応答( Vary ヘッダを伴わない応答も含む)が可用な場合、キャッシュは,利用する 1 つを選択する必要がある。
選定用ヘッダがそのための既知な仕組みを備える場合(例: Accept や それに類する要請ヘッダ上の,品質値)、その仕組みが,選好される応答を選定するために利用されてよい
— それ以外の所では、 § 4 に従って
( Date ヘッダにより決定される)最も近過去の応答が利用される。
If multiple selected responses are available (potentially including responses without a Vary header field), the cache will need to choose one to use. When a selecting header field has a known mechanism for doing so (e.g., qvalues on Accept and similar request header fields), that mechanism MAY be used to select preferred responses; of the remainder, the most recent response (as determined by the Date header field) is used, as per Section 4.
可用な被選定応答が無い場合、キャッシュは,提示された要請を満たせない — その場合、概して,要請内に示される生成元サーバへ回送される(場合によっては条件付きにして — § 4.3 を見よ)。 If no selected response is available, the cache cannot satisfy the presented request. Typically, it is forwarded to the origin server in a (possibly conditional; see Section 4.3) request.
4.2. 鮮度
齢が鮮度維持期間を超過していない応答は、 新鮮 ( fresh )であるとされる。 逆に,それを超過した応答は、 非新鮮 ( stale )とされる。 A fresh response is one whose age has not yet exceeded its freshness lifetime. Conversely, a stale response is one where it has.
【 この定義は,超過したかどうかを計算できることが前提にある。 (§ 4.2.4 の説明に従うなら、計算できない場合は,新鮮と見なされる?) 】
応答の 鮮度維持期間 とは、[ それが生成元サーバにより生成された時刻から,その失効時刻まで ]の期間である。 失効時刻 とは、それを過ぎて以降は,[ 格納済み応答は、更なる検証を伴わない限り,キャッシュにより利用できない ]とされる時刻である。 明示的な失効時刻 とは、生成元サーバが意図する失効時刻である。 一方で, 経験的な失効時刻 とは、明示的な失効時刻が可用でないときに,キャッシュによりあてがわれる失効時刻である。 A response's freshness lifetime is the length of time between its generation by the origin server and its expiration time. An explicit expiration time is the time at which the origin server intends that a stored response can no longer be used by a cache without further validation, whereas a heuristic expiration time is assigned by a cache when no explicit expiration time is available.
応答の 齢 とは、生成元サーバにより[ それが生成された, もしくは 成功裡に検証された ]ときから,経過した時間である。 A response's age is the time that has passed since it was generated by, or successfully validated with, the origin server.
キャッシュ内の応答は、新鮮である間は,[ 生成元サーバに接触することなく,後続の要請を満たす ]ために利用できる — それに伴い,効率を改善させる。 When a response is "fresh" in the cache, it can be used to satisfy subsequent requests without contacting the origin server, thereby improving efficiency.
生成元サーバにとり,鮮度を決定するための主たる仕組みは、[
Expires ヘッダ, または
max-age 応答指令
]を利用して,未来の明示的な失効時刻を供することである。
一般に,生成元サーバは、[[
およそ,それまでは[
表現が意味論的に有意な仕方で変化しない
]と見込まれる
]ような、未来の失効時刻
]を,明示的な失効時刻として応答にあてがうことになる。
The primary mechanism for determining freshness is for an origin server to provide an explicit expiration time in the future, using either the Expires header field (Section 5.3) or the max-age response directive (Section 5.2.2.8). Generally, origin servers will assign future explicit expiration times to responses in the belief that the representation is not likely to change in a semantically significant way before the expiration time is reached.
生成元サーバが、キャッシュに対し,毎要請ごとの検証を強制したいときには、過去を指す明示的な失効時刻をあてがって,応答がすでに非新鮮であることを指示できる。 準拠キャッシュは、通常は,非新鮮 キャッシュ済み応答を[ 後続の要請用に再利用する(§ 4.2.4 を見よ) ]前に,検証することになる。 If an origin server wishes to force a cache to validate every request, it can assign an explicit expiration time in the past to indicate that the response is already stale. Compliant caches will normally validate a stale cached response before reusing it for subsequent requests (see Section 4.2.4).
生成元サーバは,[ 常に,明示的な失効時刻を供する ]わけではないので、キャッシュには,一定の状況下で,失効時刻を決定する経験則を利用することも許容される( § 4.2.2 を見よ)。 Since origin servers do not always provide explicit expiration times, caches are also allowed to use a heuristic to determine an expiration time under certain circumstances (see Section 4.2.2).
応答は、次を満たすならば 新鮮である ものと決定される :( 鮮度維持期間 > 現在齢 ) The calculation to determine if a response is fresh is:response_is_fresh = (freshness_lifetime > current_age)freshness_lifetime is defined in Section 4.2.1; current_age is defined in Section 4.2.3.
クライアントは、要請内に[
max-age や min-fresh
]キャッシュ指令を送信して,対応する応答に対する鮮度の計算を
拘束する/緩める
ことができる。
Clients can send the max-age or min-fresh cache directives in a request to constrain or relax freshness calculations for the corresponding response (Section 5.2.1).
日時の構文解析法によくある問題を避けるため、キャッシュ受信者は,鮮度を計算するときには: When calculating freshness, to avoid common problems in date parsing:
-
すべての日時 形式は,文字大小区別として指定されているが、[
day, week, time-zone
]の名前†は,文字大小無視で合致させるべきである。
【†
day-name,GMTの他にmonthも含まれる? 】 • Although all date formats are specified to be case-sensitive, a cache recipient SHOULD match day, week, and time-zone names case-insensitively. -
自身の内部実装による時刻の分解能が
HTTP-date値のそれより粗い場合、構文解析したExpires日時を,[ 受信された値を超えない最も近い時刻 ]として,内部的に表現しなければならない。 • If a cache recipient's internal implementation of time has less resolution than the value of an HTTP-date, the recipient MUST internally represent a parsed Expires date as the nearest time equal to or earlier than the received value. - 地域的な時間帯を,[ 齢や失効時刻 ]の[ 計算, および比較 ]に波及させてはならない。 • A cache recipient MUST NOT allow local time zones to influence the calculation or comparison of an age or expiration time.
-
失効時刻の計算時には、[[
"
GMT", "UTC" 以外の時間帯 略語 ]が伴われた日時 ]は,無効と見なすべきである。 • A cache recipient SHOULD consider a date with a zone abbreviation other than GMT or UTC to be invalid for calculating expiration.
注記: 鮮度が適用されるのは、キャッシュ運用に限られる — 表示の更新や, リソースの再読み込みを UA に強制する用途には利用できない。 キャッシュと履歴の仕組みとの相違点は、§ 6 に説明される。 Note that freshness applies only to cache operation; it cannot be used to force a user agent to refresh its display or reload a resource. See Section 6 for an explanation of the difference between caches and history mechanisms.
4.2.1. 鮮度維持期間の計算
キャッシュは、次のうち,最初に合致する項目による値を利用して,応答の鮮度維持期間を計算できる(その計算結果は、 鮮度維持期間 と記される): A cache can calculate the freshness lifetime (denoted as freshness_lifetime) of a response by using the first match of the following:
-
キャッシュは共有されている, かつ
s-maxage応答指令が在る場合 :その値 • If the cache is shared and the s-maxage response directive (Section 5.2.2.9) is present, use its value, or -
max-age応答指令が在る場合 :その値 • If the max-age response directive (Section 5.2.2.8) is present, use its value, or -
Expires応答ヘッダが在る場合 :(その値) − (Date応答ヘッダの値) • If the Expires response header field (Section 5.3) is present, use its value minus the value of the Date response header field, or - 他の場合: 応答内には明示的な失効時刻は無い。 経験的な鮮度維持期間が適用可能になり得る — § 4.2.2 を見よ。 • Otherwise, no explicit expiration time is present in the response. A heuristic freshness lifetime might be applicable; see Section 4.2.2.
注記: この計算は,時計同期調整に脆弱でない — すべての情報は、生成元サーバから来るので。 Note that this calculation is not vulnerable to clock skew, since all of the information comes from the origin server.
所与の指令用の値が複数在る場合(例:
複数の Expires ヘッダ,
複数の "Cache-Control: max-age" 指令)、その指令の値は,無効と見なされる。
キャッシュには、[
無効な鮮度情報を持つ応答
]を,非新鮮と見なすことが奨励される。
When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives), the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale.
4.2.2. 鮮度の経験的な計算
生成元サーバは,常に明示的な失効時刻を供するわけではない。
したがって,明示的時刻が指定されていないときは、キャッシュは,[
確からしい失効時刻を見積もる
]ために[
他のヘッダ値( Last-Modified による時刻など)を利用するアルゴリズム
]を使役して,経験的な失効時刻をあてがってもよい。
この仕様は,特定のアルゴリズムは供さないが、それらの結果に対する最低限の拘束を課す。
Since origin servers do not always provide explicit expiration times, a cache MAY assign a heuristic expiration time when an explicit time is not specified, employing algorithms that use other header field values (such as the Last-Modified time) to estimate a plausible expiration time. This specification does not provide specific algorithms, but does impose worst-case constraints on their results.
キャッシュは、格納済み応答内に明示的な失効時刻が在るときには,鮮度を決定する経験則を利用してはならない。
何故なら、§ 3 による要件が実質的に意味するのは、経験則を利用し得るのは,明示的な鮮度を伴わない応答のうち,[
状態°コードが既定でキャッシュ可能であるものと定義された応答, あるいは
明示的にキャッシュ可能であるとマークされた応答(例: public 応答指令により)
]のみであることなので。
A cache MUST NOT use heuristics to determine freshness when an explicit expiration time is present in the stored response. Because of the requirements in Section 3, this means that, effectively, heuristics can only be used on responses without explicit freshness whose status codes are defined as cacheable by default (see Section 6.1 of [RFC7231]), and those responses without explicit freshness that have been marked as explicitly cacheable (e.g., with a "public" response directive).
応答が Last-Modified ヘッダを持つ場合、キャッシュには,[
その時刻から現在時までの時区間に対する ある割合
]を超えないような,経験的な失効値を利用することが奨励される。
この割合の代表的な設定は 10% 程度になるであろう。
If the response has a Last-Modified header field (Section 2.2 of [RFC7232]), caches are encouraged to use a heuristic expiration value that is no more than some fraction of the interval since that time. A typical setting of this fraction might be 10%.
鮮度維持期間を計算する際に,経験則を利用するキャッシュは、応答の 現在齢 が 24 時間を超える場合には,応答内に[
warn-code 113 を伴う Warning ヘッダ
]を生成するべきである
— そのような警告がすでに在るときは除いて。
When a heuristic is used to calculate freshness lifetime, a cache SHOULD generate a Warning header field with a 113 warn-code (see Section 5.5.4) in the response if its current_age is more than 24 hours and such a warning is not already present.
注記:
[RFC2616] § 13.9 では、[
クエリ成分を伴う URI (すなわち, ? を包含する URI )
]に対しては,キャッシュによる経験的な鮮度の計算法を禁制していたが、実施においては,これは広範に実装されていない。
したがって,生成元サーバには、キャッシュ処理を妨げたいと望む場合には,明示的な指令を送信することが奨励される(例:
Cache-Control: no-cache
)。
Note: Section 13.9 of [RFC2616] prohibited caches from calculating heuristic freshness for URIs with query components (i.e., those containing '?'). In practice, this has not been widely implemented. Therefore, origin servers are encouraged to send explicit directives (e.g., Cache-Control: no-cache) if they wish to preclude caching.
4.2.3. 齢の計算
Age ヘッダは、応答メッセージがキャッシュから得られるとき見積もられた齢を伝達するために,利用される。
Age ヘッダの値は、キャッシュにより見積もられる,[
その応答が生成元サーバにより[
生成された, または
検証された
]ときからの秒数
]である。
本質的に, Age 値は、応答が[
生成元サーバからの経路沿いにある,各キャッシュ
]に滞在していた時間と[
ネットワーク経路に沿って通過中の経過時間
]を足したものである。
The Age header field is used to convey an estimated age of the response message when obtained from a cache. The Age field value is the cache's estimate of the number of seconds since the response was generated or validated by the origin server. In essence, the Age value is the sum of the time that the response has been resident in each of the caches along the path from the origin server, plus the amount of time it has been in transit along network paths.
齢の計算には次のデータが利用される: The following data is used for the age calculation:
- 【まず,以下の説明に用いられている語の意味を補足する:】
-
- 応答
- 齢を計算する対象の,格納済み応答。
- 要請
- 応答 を格納済みにさせた要請。 (原文の説明からは,はっきりしないが、成功裡に再検証させた要請があれば,それを指すようにも思われる。)
- ホスト
- 当該のキャッシュを使役している HTTP 通信の参加者。
- 時計
- ホスト に局所的な時計。
- 齢値
-
応答 の
Ageヘッダの値を,算術演算に適切な形で表す値 — 可用でない場合†は 0。 【† 例えば、最も上流のキャッシュが,その応答の再利用を初めて試みるとき】 The term "age_value" denotes the value of the Age header field (Section 5.1), in a form appropriate for arithmetic operation; or 0, if not available. - 日時値
-
応答 の
Dateヘッダの値を,算術演算に適切な形で表す値。Dateヘッダの定義, および それを伴わない応答に関する要件は、 [RFC7231] § 7.1.1.2 を見よ。 The term "date_value" denotes the value of the Date header field, in a form appropriate for arithmetic operations. See Section 7.1.1.2 of [RFC7231] for the definition of the Date header field, and for requirements regarding responses without it. - 現在時
- ホスト がこの計算を遂行している時点での, 時計 の現在の値。 ホスト は、 NTP [RFC5905], または 何らかの類似なプロトコルを利用して, 時計 を UTC(協定世界時, Coordinated Universal Time )に同期させるべき.である。 The term "now" means "the current value of the clock at the host performing the calculation". A host ought to use NTP ([RFC5905]) or some similar protocol to synchronize its clocks to Coordinated Universal Time.
- 要請時刻
- 要請 が受信された時点での, 時計 の値。 The current value of the clock at the host at the time the request resulting in the stored response was made.
- 応答時刻
- 応答 が受信された時点での, 時計 の値。 The current value of the clock at the host at the time the response was received.
応答 の齢は、全く独立な 2 つの仕方で計算できる:
- 見かけ齢 = max( 0, 応答時刻 − 日時値 ) :時計 と, 生成元サーバの時計とが、適度によく同期されているならば。
-
補正済み齢値 = 齢値 + 応答遅延,
応答遅延 = ( 応答時刻 − 要請時刻 ) :応答 の経路沿いにある すべてのキャッシュが, HTTP/1.1 を実装するならば。 キャッシュは、この値を,[ 応答 が受信された時刻ではなく, 要請 が起動された時刻 ]から相対的に解釈しなければならない。
これらは,次のように結合される :補正済み初期齢 = max( 見かけ齢, 補正済み齢値 ) These are combined as • corrected_initial_age = max( apparent_age, corrected_age_value );
…ただし、キャッシュが Age ヘッダの値( 齢値 )に確信を持てる場合(例えば,応答 の Via ヘッダ内に HTTP/1.0 を示唆する hop がないなど)には、
補正済み初期齢 の代わりに 補正済み齢値 が利用されてよい。
unless the cache is confident in the value of the Age header field (e.g., because there are no HTTP/1.0 hops in the Via header field), in which case the corrected_age_value MAY be used as the corrected_initial_age.
しかる後、 応答 の 現在齢 を計算できる — 応答 が生成元サーバにより 最後に検証されたときから 補正済み初期齢 までの経過時間(秒)を加えて :滞在時間 = 現在時 − 応答時刻, 現在齢 = 補正済み初期齢 + 滞在時間 The current_age of a stored response can then be calculated by adding the amount of time (in seconds) since the stored response was last validated by the origin server to the corrected_initial_age. • resident_time = now - response_time; • current_age = corrected_initial_age + resident_time;
4.2.4. 非新鮮 応答のサーブ法
応答が非新鮮であるとは、[ 明示的な失効時期情報を持つ, または 失効時期の経験的な計算が許容されている ]ものであって,§ 4.2 による計算に則って新鮮でないとされたものになる。 A "stale" response is one that either has explicit expiry information or is allowed to have heuristic expiry calculated, but is not fresh according to the calculations in Section 4.2.
キャッシュは:
-
プロトコル内の明示的なキャッシュ指令 — 例えば,次に挙げる指令 — により禁制されている場合は,非新鮮 応答を生成してはならない:
-
no-store/no-cache要請キャッシュ指令 -
no-store/no-cache応答キャッシュ指令 -
must-revalidate応答キャッシュ指令 -
適用可能な
s-maxage/proxy-revalidate応答キャッシュ指令
-
-
次の場合を除き、非新鮮 応答を送信してはならない: A cache MUST NOT send stale responses unless\
-
非新鮮 応答内には,[
warn-code110を伴うWarningヘッダ ]を生成するべきである。 A cache SHOULD generate a Warning header field with the 110 warn-code (see Section 5.5.1) in stale responses.\同様に,キャッシュが 【内方から】 切断されている場合は、非新鮮 応答内に,[
warn-code112を伴うWarningヘッダ ]を 【も?】 生成するべきである。 Likewise, a cache SHOULD generate a 112 warn-code (see Section 5.5.3) in stale responses if the cache is disconnected. -
Ageヘッダを持たない応答を回送するときには、応答がすでに非新鮮であっても,新たなWarningヘッダを生成するべきでない。 キャッシュは、単に通過中に非新鮮になった応答は,検証する必要はない。 A cache SHOULD NOT generate a new Warning header field when forwarding a response that does not have an Age header field, even if the response is already stale. A cache need not validate a response that merely became stale in transit.
4.3. 検証
キャッシュが,[ 要請された URI 用に 1 つ以上の格納済み応答を持つ ]が、それらのどれをもサーブできないときは(例: それらが新鮮でないとき, または 1 つに選定できない( § 4.1 )ことから )、要請を回送する際に,条件付き要請の仕組みを利用して、次の内方サーバに,次を行う機会を与えることができる: When a cache has one or more stored responses for a requested URI, but cannot serve any of them (e.g., because they are not fresh, or one cannot be selected; see Section 4.1), it can use the conditional request mechanism [RFC7232] in the forwarded request to give the next inbound server an opportunity\
- 利用する有効な格納済み応答を選定する。 to select a valid stored response to use,\
- 処理において格納済みメタデータを更新する。 updating the stored metadata in the process, or\
- 格納済み応答(たち)を新たな応答で代用する。 to replace the stored response(s) with a new response.\
この処理は、格納済み応答の — 検証処理 / 再検証処理 として知られている。 This process is known as "validating" or "revalidating" the stored response.
4.3.1. 検証要請の送信
キャッシュ検証用に条件付き要請を送信するキャッシュは、[ その格納済み応答(たち)からの検証子メタデータ ]を包含している, 1 つ以上の事前条件ヘッダを送信する — しかる後、それらは,受信者たちにより[ 格納済み応答がリソースの現在の表現に等価である ]かどうかを決定するために比較される。 When sending a conditional request for cache validation, a cache sends one or more precondition header fields containing validator metadata from its stored response(s), which is then compared by recipients to determine whether a stored response is equivalent to a current representation of the resource.
そのような検証子の一つは、 Last-Modified ヘッダにて与えられる時刻印である
— それは、[
応答を検証するために
If-Modified-Since ヘッダにて
], あるいは[
表現を選定するために
If-Unmodified-Since / If-Range ヘッダにて
],利用できる(すなわち,クライアントは、以前に得た[
その時刻印を伴う表現
]を,特に指している)。
One such validator is the timestamp given in a Last-Modified header field (Section 2.2 of [RFC7232]), which can be used in an If-Modified-Since header field for response validation, or in an If-Unmodified-Since or If-Range header field for representation selection (i.e., the client is referring specifically to a previously obtained representation with that timestamp).
検証子には、 ETag ヘッダ内に与えられる entity-tag もある。
1 個以上の格納済み応答を指示する 1 個以上の entity-tag を、[
応答を検証するためとして
If-None-Match ヘッダにて
], あるいは[
表現を選定するためとして
If-Match / If-Range
ヘッダにて
],利用できる(すなわち,クライアントは、以前に得た[
リストされた entity-tag を伴う, 1 個以上の表現
]を,特に指している)。
Another validator is the entity-tag given in an ETag header field (Section 2.3 of [RFC7232]). One or more entity-tags, indicating one or more stored responses, can be used in an If-None-Match header field for response validation, or in an If-Match or If-Range header field for representation selection (i.e., the client is referring specifically to one or more previously obtained representations with the listed entity-tags).
4.3.2. 受信された検証要請の取り扱い
要請 連鎖における各クライアントは,自前のキャッシュを持ち得るので、媒介者におけるキャッシュが[ 他の(外方)キャッシュから 条件付き要請を受信する ]ことは,よくある。 同様に,一部の UA は、[ 近過去に改変された表現に対しては データ転送を制限したり,部分的に検索取得された表現の転送を完了する ]ために、条件付き要請を用立てる。 Each client in the request chain may have its own cache, so it is common for a cache at an intermediary to receive conditional requests from other (outbound) caches. Likewise, some user agents make use of conditional requests to limit data transfers to recently modified representations or to complete the transfer of a partially retrieved representation.
キャッシュは、[
自身に格納済みな[
200 (OK) / 206 (Partial Content)
]応答を再利用することで満たせるような,要請
]を受信したときは、
要請内に見出された条件付きヘッダによる事前条件たちのうち:
If a cache receives a request that can be satisfied by reusing one of its stored 200 (OK) or 206 (Partial Content) responses,\
- 自身に適用可能なものを,[ 被選定応答の中に包含されている対応する検証子たち ]に対して評価するべきである — ただし、 the cache SHOULD evaluate any applicable conditional header field preconditions received in that request with respect to the corresponding validators contained within the selected response.\
-
次のいずれかに該当する事前条件は、評価してはならない: A cache MUST NOT evaluate conditional header fields that are\
- 生成元サーバのみに適用可能であるもの only applicable to an origin server,\
- キャッシュ済み応答により満たし得ない意味論を伴うもの found in a request with semantics that cannot be satisfied with a cached response, or\
- 格納済み応答を持たないターゲットリソースに適用されるもの applied to a target resource for which it has no stored responses;\
これらの事前条件は、何らかの他の(内方)サーバ向けに意図されている見込みが高いので。 such preconditions are likely intended for some other (inbound) server.
キャッシュによる条件付き要請の適正な評価は、[
受信された事前条件ヘッダたち, およびそれらの優先順( [RFC7232] § 6 )
]に依存する。
If-Match / If-Unmodified-Since
条件付きヘッダは、キャッシュには適用可能でない。
The proper evaluation of conditional requests by a cache depends on the received precondition header fields and their precedence, as defined in Section 6 of [RFC7232]. The If-Match and If-Unmodified-Since conditional header fields are not applicable to a cache.
If-None-Match ヘッダを包含する要請は、[
クライアントが,[
1 個以上の自前の格納済み応答
]と, [
キャッシュにより格納済みな被選定応答が何であれ,それら
]とを比較して検証することを求めている
]ことを指示する。
そのヘッダ値が[
"*" である, または[
entity-tag のリストであって,そのうち いずれかが[
格納済みな被選定応答の entity-tag
]に合致する
【すなわち,評価の結果が偽になる】
]]場合、キャッシュ受信者は,その合致した応答を送信する代わりに,(その応答のメタデータを利用して,) 304 (Not Modified) 応答を生成するべきである。
A request containing an If-None-Match header field (Section 3.2 of [RFC7232]) indicates that the client wants to validate one or more of its own stored responses in comparison to whichever stored response is selected by the cache. If the field-value is "*", or if the field-value is a list of entity-tags and at least one of them matches the entity-tag of the selected stored response, a cache recipient SHOULD generate a 304 (Not Modified) response (using the metadata of the selected stored response) instead of sending that stored response.
キャッシュは、[
If-None-Match による entity-tag のリスト(以下, L と記す)を包含する要請
]用に,自前の格納済み応答たちを再検証すると裁定したときには:
When a cache decides to revalidate its own stored responses for a request that contains an If-None-Match list of entity-tags,\
-
要請を回送する際に,その
If-None-Matchヘッダ値を,[ L と[ 各[ 自前の格納済み応答(新鮮も非新鮮も) ]のentity-tagたちからなるリスト ]とを結合した結果の和集合 ]に置き換えて送信してよい — ただし, the cache MAY combine the received list with a list of entity-tags from its own stored set of responses (fresh or stale) and send the union of the two lists as a replacement If-None-Match header field value in the forwarded request.\ -
部分的な内容を包含するような格納済み応答の
entity-tagは、この和集合からは除外しなければならない — ただし,要請が範囲要請であり,その部分的な格納済み応答で全部的に満たされることになる場合は除く。 If a stored response contains only partial content, the cache MUST NOT include its entity-tag in the union unless the request is for a range that would be fully satisfied by that partial stored response.\ -
回送した要請に対する応答 R が,[
304(Not Modified) である, かつETagヘッダを伴う, かつ そのヘッダ値は L 内に無いentity-tagを含む ]場合、そのentity-tagに対応する格納済み応答を再利用しつつ, R のメタデータで更新した上で(§ 4.3.4 )、クライアントに対し200(OK) 応答を生成しなければならない If the response to the forwarded request is 304 (Not Modified) and has an ETag header field value with an entity-tag that is not in the client's list, the cache MUST generate a 200 (OK) response for the client by reusing its corresponding stored response, as updated by the 304 response metadata (Section 4.3.4).
If-None-Match ヘッダは無いが,
If-Modified-Since ヘッダは包含する要請(以下,そのヘッダ値に供された値による時刻を 時刻印 と記す)は、[
クライアントが,[
1 個以上の 自前の格納済み応答を,改変日時について検証する
]ことを求めている
]ことを指示する。
キャッシュ受信者は、[
格納済みな被選定応答(以下 R と記す)について,次のいずれかが真
]ならば、( R のメタデータを利用して,) 304 (Not Modified) 応答を生成するべきである:
If an If-None-Match header field is not present, a request containing an If-Modified-Since header field (Section 3.3 of [RFC7232]) indicates that the client wants to validate one or more of its own stored responses by modification date. A cache recipient SHOULD generate a 304 (Not Modified) response (using the metadata of the selected stored response) if one of the following cases is true:\
-
R は
Last-Modifiedヘッダを持っていて,その値による時刻は 時刻印 を過ぎていない 1) the selected stored response has a Last-Modified field-value that is earlier than or equal to the conditional timestamp;\ -
R は
Last-Modifiedヘッダを持たないが、Dateヘッダは持っていて,その値による時刻は 時刻印 を過ぎていない ] 2) no Last-Modified field is present in the selected stored response, but it has a Date field-value that is earlier than or equal to the conditional timestamp; or,\ -
R は
Last-ModifiedもDateも持たないが、 R は,キャッシュにおいて 時刻印 を過ぎていない時刻に受信されたものと記録されている。 3) neither Last-Modified nor Date is present in the selected stored response, but the cache recorded it as having been received at a time earlier than or equal to the conditional timestamp.
範囲要請に対する部分的応答を実装する
キャッシュは、
[RFC7233]にて定義されるように,
受信された If-Range ヘッダを
自身に格納済みな被選定応答に対して評価する必要もある。
A cache that implements partial responses to range requests, as defined in [RFC7233], also needs to evaluate a received If-Range header field (Section 3.2 of [RFC7233]) with respect to its selected stored response.
4.3.3. 検証応答の取り扱い
キャッシュによる,[ 条件付き要請に対する応答 ]の取り扱いは、その状態°コードに依存する: Cache handling of a response to a conditional request is dependent upon its status code:
-
応答状態°コード
304(Not Modified) は、[ 格納済み応答を,更新できる/再利用できる ]ことを指示する — § 4.3.4 を見よ。 • A 304 (Not Modified) response status code indicates that the stored response can be updated and reused; see Section 4.3.4. - 全部的な応答(すなわち,ペイロード本体を伴うもの)は、[ 条件付き要請内に挙げられた,どの格納済み応答 ]も,相応しくないことを指示する。 代わりに,キャッシュは、要請を満たすために,その全部的な応答を利用しなければならない — また、格納済み応答(たち)を代用してよい。 • A full response (i.e., one with a payload body) indicates that none of the stored responses nominated in the conditional request is suitable. Instead, the cache MUST use the full response to satisfy the request and MAY replace the stored response(s).
-
しかしながら、キャッシュは,[ 応答の検証を試みている間に
5xx(Server Error) 応答を受信した ]ときには、次のいずれかを行える: • However, if a cache receives a 5xx (Server Error) response while attempting to validate a response, it can either\-
要請しているクライアントへ,この
5xx応答を回送する。 forward this response to the requesting client, or - サーバが応答に失敗したかのように動作する。 この場合、以前に格納済みな応答を送信してよい( § 4.2.4 を見よ)。 act as if the server failed to respond. In the latter case, the cache MAY send a previously stored response (see Section 4.2.4).
-
要請しているクライアントへ,この
4.3.4. 検証にあたっての,格納済み応答の新鮮化法
304 (Not Modified) 応答(以下,この節を通して 304 応答 と記す)を受信したキャッシュは、同じキャッシュキー用の格納済み 200 (OK) 応答が 1 個以上あるときは(以下,それらの集合を S と記す)、[
S の中のどれが 304 応答 により更新されるか
]を選定した上で、それらを,
304 応答 内に供された新たな情報を用いて更新する必要がある。
When a cache receives a 304 (Not Modified) response and already has one or more stored 200 (OK) responses for the same cache key, the cache needs to identify which of the stored responses are updated by this new response and then update the stored response(s) with the new information provided in the 304 response.
更新対象として選定される格納済み応答は、 304 応答 の検証子に応じて,次で与えられる: The stored response to update is identified by using the first match (if any) of the following:
- 304 応答 は強い検証子を包含する場合: • If the new response contains a strong validator (see Section 2.1 of [RFC7232]), then\
- その強い検証子が,更新する選定された表現を識別する — すなわち、 S 内の,同じ強い検証子を伴うものすべてが選定される。 that strong validator identifies the selected representation for update. All of the stored responses with the same strong validator are selected.\
- そのような格納済み応答が無い場合、キャッシュは, 304 応答 を どの格納済み応答の更新にも利用してはならない。 【この説明から、仮に 304 応答 が弱い検証子も包含していたとしても,次項は適用されないと見られる。】 If none of the stored responses contain the same strong validator, then the cache MUST NOT use the new response to update any stored responses.
- 304 応答 は弱い検証子を包含する場合: • If the new response contains a weak validator\
- S 内にその検証子に合致するものがあれば、それらのうち最も近過去のものが選定される。 and that validator corresponds to one of the cache's stored responses, then he most recent of those matching stored responses is selected for update.
- 304 応答 は検証子を含まない場合: • If the new response does not include any form of validator\
-
(例えば、クライアントが
Last-Modified応答ヘッダ以外のソースから,If-Modified-Since要請を生成したなど。) (such as in the case where a client generates an If-Modified-Since request from a source other than the Last-Modified response header field),\ - S が唯一つの格納済み応答からなる, かつ その応答も検証子を欠くならば、その応答が選定される。 and there is only one stored response, and that stored response also lacks a validator, then that stored response is selected for update.
更新対象の格納済み応答が選定されたならば、キャッシュは,その各 応答 に対し,次をしなければならない: If a stored response is selected for update, the cache MUST:
-
応答 内の[
warn-code1xxを伴うWarningヘッダ ]は,すべて削除する。 • delete any Warning header fields in the stored response with warn-code 1xx (see Section 5.5); -
応答 内の[
warn-code2xxを伴うWarningヘッダ ]は,すべて維持する。 • retain any Warning header fields in the stored response with warn-code 2xx; and, - 304 応答 内に供された他の各ヘッダ h に対し: 応答 内の[ h に対応するヘッダのインスタンスたち ]を, h で代用する。 • use other header fields provided in the 304 (Not Modified) response to replace all instances of the corresponding header fields in the stored response.
4.3.5. HEAD を介する応答の新鮮化法
HEAD メソッドに対する応答は、本体を欠くことを除き,[
GET による等価な要請により為される応答
]と一致する。
この HEAD 応答の特質を、次の場合に[
キャッシュされた GET 応答を無効化したり更新する
]ことに利用できる:
A response to the HEAD method is identical to what an equivalent request made with a GET would have been, except it lacks a body. This property of HEAD responses can be used to invalidate or update a cached GET response\
-
より効率的な条件付き
GET要請の仕組みが(格納済み応答内に検証子が無いことに因り)可用でない場合。 if the more efficient conditional GET request mechanism is not available (due to no validators being present in the stored response) or\ - 表現が変更されたときでも,その本体の伝送は欲されない場合。 if transmission of the representation body is not desired even if it has changed.
キャッシュが[
所与の要請ターゲット用に,内方へ HEAD 要請を為して,
200 (OK) 応答(以下 HEAD 応答 と記す)を受信した
]ときは、[
その要請用に選定し得た,自身に格納済みな[
GET に対する応答
]]のそれぞれを,更新するか, または無効化するべきである( § 4.1 を見よ)。
すなわち,…
When a cache makes an inbound HEAD request for a given request target and receives a 200 (OK) response, the cache SHOULD update or invalidate each of its stored GET responses that could have been selected for that request (see Section 4.1).
キャッシュは、選定し得た,各 格納済み応答 応答 に対し: For each of the stored responses that could have been selected,\
-
次のいずれも満たされるならば、 下に述べるように 応答 を更新するべきである:
-
受信されたどの検証子ヘッダ(
ETag,Last-Modified)に対しても, 応答 と HEAD 応答 は合致する値を持つ。 -
HEAD 応答 も 応答 も
Content-Lengthヘッダを持ち, それらの値は合致する。
-
受信されたどの検証子ヘッダ(
- 他の場合、 応答 を非新鮮であると見なすべきである。 otherwise, the cache SHOULD consider the stored response to be stale.
キャッシュが格納済み応答 応答 を, HEAD 応答 内に供されたメタデータで更新するときは、次を行わなければならない: If a cache updates a stored response with the metadata provided in a HEAD response, the cache MUST:
-
応答 内の[
warn-code1xxを伴うWarningヘッダ ]は,すべて削除する。 • delete any Warning header fields in the stored response with warn-code 1xx (see Section 5.5); -
応答 内の[
warn-code2xxを伴うWarningヘッダ ]は,すべて維持する。 • retain any Warning header fields in the stored response with warn-code 2xx; and, -
HEAD 応答 内に供された他の各ヘッダ h に対し,
Cache-Controlヘッダにより制約されるものは除き:- 応答 内に h と同じ名前のヘッダたちがあれば,それらを h で代用する。
- 他の場合、 応答 のヘッダ節に h を付加する。
4.4. 無効化
[
PUT, POST, DELETE
]などの,安全でない要請メソッドは、生成元サーバ上の状態を変更する可能性があるので、介在しているキャッシュは,それらを利用して 自身の内容を最新状態に保つことができる。
Because unsafe request methods (Section 4.2.1 of [RFC7231]) such as PUT, POST or DELETE have the potential for changing state on the origin server, intervening caches can use them to keep their contents up to date.
キャッシュは、[
安全でない, または安全かどうか未知である
]ような要請メソッドに対する応答内に,非エラー 状態°コード
— 2xx (Successful) または 3xx (Redirection) —
を受信したときには:
- 実効要請 URI を無効化しなければならない。
-
加えて、要請メソッドが安全でない場合には:
Location/Content-Location応答ヘッダによる URI についても,そのホスト部分が実効要請 URI 内のホスト部分と、
ここでの,URI を 無効化する とは、キャッシュが,[ その URI に関係する,すべての格納済み応答 ]に対し、次のいずれかを行うことを意味する: Here, a "non-error response" is one with a 2xx (Successful) or 3xx (Redirection) status code. "Invalidate" means that the cache will either\
- それらの応答をすべて除去する。 remove all stored responses related to the effective request URI or\
- それらの応答を “無効” とマークした上で、後続の要請に対する応答として送信できるようになる前に,検証を義務付ける。 will mark these as "invalid" and in need of a mandatory validation before they can be sent in response to a subsequent request.
注記: これは、該当するすべての応答が無効化されることを保証しない。 例えば,状態変更要請は、それが渡り歩くキャッシュ内の応答については,無効化するであろうが、他のキャッシュ内の関連する応答は,依然として格納されたままになるであろう。 Note that this does not guarantee that all appropriate responses are invalidated. For example, a state-changing request might invalidate responses in the caches it travels through, but relevant responses still might be stored in other caches that it has not.
5. ヘッダ定義
この節では、キャッシュ処理に関係する各種 HTTP/1.1 ヘッダの,構文と意味論を定義する。 This section defines the syntax and semantics of HTTP/1.1 header fields related to caching.
5.1. Age
Age ヘッダは、送信者により見積もられた[
応答が生成元サーバにて,生成された/成功裡に検証された
]ときからの経過時間
— 齢 —
を伝達する。
齢値の計算法は § 4.2.3 にて指定される。
The "Age" header field conveys the sender's estimate of the amount of time since the response was generated or successfully validated at the origin server. Age values are calculated as specified in Section 4.2.3.
Age=delta-seconds
Age ヘッダ値は、秒数を表現する負でない整数である(§ 1.2.1 を見よ)。
The Age field-value is a non-negative integer, representing time in seconds (see Section 1.2.1).
【応答の受信者にとっては,】
Age ヘッダが在ることは、この要請に対する応答が,生成元サーバにより[
生成されていない/検証されていない
]ことを含意する。
しかしながら, Age ヘッダを欠くからといって、生成元が接触されたことを含意するとは限らない
— 応答は, Age を実装しない HTTP/1.0 キャッシュから受信されることもあるので。
The presence of an Age header field implies that the response was not generated or validated by the origin server for this request. However, lack of an Age header field does not imply the origin was contacted, since the response might have been received from an HTTP/1.0 cache that does not implement Age.
5.2. Cache-Control
Cache-Control ヘッダは、
キャッシュ制御指令†
— 要請/応答の連鎖沿いにあるキャッシュたちのふるまいを制御するための指令 —
を指定するために,利用される。
そのような指令は、要請に指令が在っても[
応答にも,同じ指令が与えられる
]ことを含意しない点で,単方向である。
The "Cache-Control" header field is used to specify directives for caches along the request/response chain. Such cache directives are unidirectional in that the presence of a directive in a request does not imply that the same directive is to be given in the response.
【†
単に,
指令,
キャッシュ指令
とも記される。
あるいは
Cache-Control 指令
とも記される
— 他の仕様が、
“キャッシュ制御指令”
を利用する,何らかの他のヘッダを定義する可能性も排除されないが。
】【
要請/応答
にて指定されるキャッシュ指令は、
要請指令/応答指令
とも記される。
】
キャッシュは、この節にて定義される,各種 Cache-Control 指令の要件を順守しなければならない。
他所で定義される Cache-Control 指令の取り扱い法についての情報は、
§ 5.2.3 を見よ。
A cache MUST obey the requirements of the Cache-Control directives defined in this section. See Section 5.2.3 for information about how Cache-Control directives defined elsewhere are handled.
注記:
HTTP/1.0 キャッシュには、 Cache-Control を実装しないものもある。
Note: Some HTTP/1.0 caches might not implement Cache-Control.
プロキシは、回送されるメッセージにおける どのキャッシュ指令も,通過させなければならない — プロキシ自身がキャッシュを実装するかどうかに関わらず, あるいは その指令を有意に適用できるかどうかに関わらず — 指令は、要請/応答の連鎖沿いにある すべての受信者に適用可能になり得るものであり、特定のキャッシュのみを適用対象にできないので。 A proxy, whether or not it implements a cache, MUST pass cache directives through in forwarded messages, regardless of their significance to that application, since the directives might be applicable to all recipients along the request/response chain. It is not possible to target a directive to a specific cache.
キャッシュ指令は、文字大小無視 token により識別され,省略可能な引数もとり得る。
引数には,[
token, quoted-string
]のいずれの構文も利用され得る。
受信者は:
Cache directives are identified by a token, to be compared case-insensitively, and have an optional argument, that can use both token and quoted-string syntax.\
- この仕様にて定義される指令に対しては、(引数を定義するものであれば)両構文とも受容するべき.である — 片方が選好されると文書化されているものもあるが。 For the directives defined below that define arguments, recipients ought to accept both forms, even if one is documented to be preferred.\
- この仕様にて定義されない指令に対しては、両構文とも受容しなければならない。 For any directive not defined by this specification, a recipient MUST accept both forms.
Cache-Control= 1#cache-directivecache-directive=token[ "=" (token/quoted-string) ]
特に言明されない限り、以下に定義されるキャッシュ指令には,引数は定義されない(許容されない)。 For the cache directives defined below, no argument is defined (nor allowed) unless stated otherwise.
5.2.1. 要請 Cache-Control 指令
5.2.1.1. max-age
引数の構文: Argument syntax:
delta-seconds
max-age 要請指令は、[
クライアントは、齢が指定された秒数を超えるような応答を 受容するつもりがない
]ことを指示する。
max-stale 要請指令も在る場合を除き,クライアントは,非新鮮 応答を受容するつもりはないことになる。
The "max-age" request directive indicates that the client is unwilling to accept a response whose age is greater than the specified number of seconds. Unless the max-stale request directive is also present, the client is not willing to accept a stale response.
この指令は、引数構文として token 形(例:
max-age=5
)を利用する。
送信者は、 quoted-string 形(例:
max-age="5"
)を生成するべきでない。
This directive uses the token form of the argument syntax: e.g., 'max-age=5' not 'max-age="5"'. A sender SHOULD NOT generate the quoted-string form.
5.2.1.2. max-stale
引数の構文: Argument syntax:
delta-seconds
max-stale 要請指令は[
クライアントは、指定された延長時間まで,鮮度維持期間を超過した応答を受容する用意がある
]ことを指示する。
延長時間は、引数に値があてがわれて[
いるならば それに指定された秒数 /
いないならば 無限
]になる。
The "max-stale" request directive indicates that the client is willing to accept a response that has exceeded its freshness lifetime. If max-stale is assigned a value, then the client is willing to accept a response that has exceeded its freshness lifetime by no more than the specified number of seconds. If no value is assigned to max-stale, then the client is willing to accept a stale response of any age.
この指令は、引数構文として token 形(例:
max-stale=10
)を利用する。
送信者は、 quoted-string 形(例:
max-stale="10"
)を生成するべきでない。
This directive uses the token form of the argument syntax: e.g., 'max-stale=10' not 'max-stale="10"'. A sender SHOULD NOT generate the quoted-string form.
5.2.1.3. min-fresh
引数の構文: Argument syntax:
delta-seconds
min-fresh 要請指令は、[
クライアントは、応答の鮮度維持期間が[
応答の現在の齢に,指定された秒数を足したもの
]以上であるならば,受容する用意がある
]ことを指示する。
すなわち,クライアントは、少なくとも指定された秒数までは,応答が新鮮であり続けることを求めている。
The "min-fresh" request directive indicates that the client is willing to accept a response whose freshness lifetime is no less than its current age plus the specified time in seconds. That is, the client wants a response that will still be fresh for at least the specified number of seconds.
この指令は、引数構文として token 形(例:
max-fresh=20
)を利用する。
送信者は、 quoted-string 形(例:
max-fresh="20"
)を生成するべきでない。
This directive uses the token form of the argument syntax: e.g., 'min-fresh=20' not 'min-fresh="20"'. A sender SHOULD NOT generate the quoted-string form.
5.2.1.4. no-cache
no-cache 要請指令は、[
キャッシュは、生成元サーバ上での成功裡な検証を伴わずに,この要請を満たすために格納済み応答を利用してはならない
]ことを指示する。
The "no-cache" request directive indicates that a cache MUST NOT use a stored response to satisfy the request without successful validation on the origin server.
5.2.1.5. no-store
no-store 要請指令は、
私用キャッシュ, 共用キャッシュ
のいずれにも適用され,[
キャッシュは、[
この要請, および それに対する どの応答
]の どの部分も,格納してはならない
]ことを指示する
— すなわち,キャッシュは:
The "no-store" request directive indicates that a cache MUST NOT store any part of either this request or any response to it. This directive applies to both private and shared caches. "MUST NOT store" in this context means that the cache\
- 不揮発ストレージに意図的にその情報を格納してはならない。 MUST NOT intentionally store the information in non-volatile storage, and\
- それを回送したならば、可能な限り迅速に, その情報を揮発ストレージから除去することに極力努めなければならない。 MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible after forwarding it.
この指令は、プライバシーを確保するための仕組みとして,依拠可能でも, 足るものでもない。 特に、悪意的な, あるいは弱体化されたキャッシュは,この指令を認識しなかったり順守しないかもしれず、通信ネットワークは,盗聴に脆弱になるかもしれない。 This directive is NOT a reliable or sufficient mechanism for ensuring privacy. In particular, malicious or compromised caches might not recognize or obey this directive, and communications networks might be vulnerable to eavesdropping.
注記:
この指令を包含する要請が,キャッシュに格納済みな応答により満たされた場合、
no-store 要請指令は,その格納済み応答には適用されない。
Note that if a request containing this directive is satisfied from a cache, the no-store request directive does not apply to the already stored response.
5.2.1.6. no-transform
no-transform 要請指令は、[
媒介者は(キャッシュを実装するかどうかに関わらず),ペイロードを形式変換してはならない
]ことを指示する。
The "no-transform" request directive indicates that an intermediary (whether or not it implements a cache) MUST NOT transform the payload, as defined in Section 5.7.2 of [RFC7230].
5.2.1.7. only-if-cached
only-if-cached 要請指令は、[
クライアントが,格納済み応答を得ることのみを望む
]ことを指示する。
この指令を受信したキャッシュは、[
要請による他の拘束に整合する,格納済み応答
]を利用して応答する, あるいは
504 (Gateway Timeout) で応答するべきである。
[
緊密に連携し, 一体化されたシステムとして運用されている,一群のキャッシュ
]に属するキャッシュは、そのような要請を,そのキャッシュ群の中で回送してよい。
The "only-if-cached" request directive indicates that the client only wishes to obtain a stored response. If it receives this directive, a cache SHOULD either respond using a stored response that is consistent with the other constraints of the request, or respond with a 504 (Gateway Timeout) status code. If a group of caches is being operated as a unified system with good internal connectivity, a member cache MAY forward such a request within that group of caches.
5.2.2. 応答 Cache-Control 指令
5.2.2.1. must-revalidate
must-revalidate 応答指令は、キャッシュに対し,[
非新鮮になった応答は,[
生成元サーバ上で成功裡に検証されないまま,後続の要請を満たす
]ために利用されてはならない
]ことを指示する。
The "must-revalidate" response directive indicates that once it has become stale, a cache MUST NOT use the response to satisfy subsequent requests without successful validation on the origin server.
must-revalidate 指令は、ある種のプロトコル特能用に依拠可能な運用をサポートするために,必要とされる。
キャッシュは、どのような状況下でも, must-revalidate 指令を順守しなければならない
— 特に,キャッシュは、何らかの事由で生成元サーバに到達できない場合には,
504 (Gateway Timeout) 応答を生成しなければならない。
The must-revalidate directive is necessary to support reliable operation for certain protocol features. In all circumstances a cache MUST obey the must-revalidate directive; in particular, if a cache cannot reach the origin server for any reason, it MUST generate a 504 (Gateway Timeout) response.
サーバが must-revalidate 指令を利用するのは、[
表現に対する要請の検証に失敗した結果が,不正な運用になる
]とき
— 報告もなく実行されなかった金融取引など —
そのときに限られるべき.である。
The must-revalidate directive ought to be used by servers if and only if failure to validate a request on the representation could result in incorrect operation, such as a silently unexecuted financial transaction.
5.2.2.2. no-cache
引数の構文: Argument syntax:
#field-name
【引数を伴わない】
no-cache 応答指令は、[
その応答は,[
生成元サーバ上で成功裡に検証されないまま,後続の要請を満たす
]ために,利用されてはならない
]ことを指示する。
これにより,生成元サーバは、[
キャッシュが非新鮮 応答を送信するように環境設定されていたとしても,キャッシュがサーバに接触しないまま,要請を満たすために その種の応答を利用する
]ことを,防止できるようになる。
The "no-cache" response directive indicates that the response MUST NOT be used to satisfy a subsequent request without successful validation on the origin server. This allows an origin server to prevent a cache from using it to satisfy a request without contacting it, even by caches that have been configured to send stale responses.
no-cache 応答指令が,【その引数により】
1 個以上のヘッダ名を指定する場合、キャッシュは:
If the no-cache response directive specifies one or more field-names, then\
- キャッシュ処理に対する他の制約の対象の下で、その応答を,後続の要請を満たすために利用してよい。 a cache MAY use the response to satisfy a subsequent request, subject to any other restrictions on caching.\
- しかしながら,引数にリストされた どのヘッダも、生成元サーバ上での成功裡な再検証を伴わないまま,後続の要請に対する応答内に送信してはならない。 However, any header fields in the response that have the field-name(s) listed MUST NOT be sent in the response to a subsequent request without successful revalidation with the origin server.\
これにより,生成元サーバは、応答内における一定のヘッダの再利用を,応答の残りの部分のキャッシュ処理は許容しつつ,防止できるようになる。 This allows an origin server to prevent the re-use of certain header fields in a response, while still allowing caching of the rest of the response.
引数に与え得るヘッダ名は、この仕様にて定義される各種ヘッダに制限されない。 ヘッダ名は、文字大小無視である。 The field-names given are not limited to the set of header fields defined by this specification. Field names are case-insensitive.
この指令は、引数の構文として quoted-string を利用する:
送信者は token 形を生成するべきでない(引用符が不要に見える,単独のエントリからなるリストであっても)。
This directive uses the quoted-string form of the argument syntax. A sender SHOULD NOT generate the token form (even if quoting appears not to be needed for single-entry lists).
注記:
多くの HTTP/1.0 キャッシュの実装に移植( back-port )されてはいるが、中には,この指令を認識しない, あるいは順守しない HTTP/1.0 キャッシュもある。
また、引数をとる no-cache 応答指令は、キャッシュからは,引数なしの no-cache 指令が受信されたかのように取り扱われることが多い
— すなわち,引数付きに対する特別な取り扱いは、広範に実装されていない。
Note: Although it has been back-ported to many implementations, some HTTP/1.0 caches will not recognize or obey this directive. Also, no-cache response directives with field-names are often handled by caches as if an unqualified no-cache directive was received; i.e., the special handling for the qualified form is not widely implemented.
5.2.2.3. no-store
no-store 応答指令は、
私用キャッシュ, 共用キャッシュ
のいずれにも適用され,[
キャッシュは、[
直の†要請 or 応答
]のいずれに対しても,その どの部分も格納してはならない
]ことを指示する。
【† 応答を生じさせた要請がストレージに残っている場合は,それも抹消する?】
— すなわち,キャッシュは:
The "no-store" response directive indicates that a cache MUST NOT store any part of either the immediate request or response. This directive applies to both private and shared caches. "MUST NOT store" in this context means that the cache\
- 不揮発ストレージに意図的にその情報を格納してはならない。 MUST NOT intentionally store the information in non-volatile storage, and\
- それを回送したならば、可能な限り迅速に, その情報を揮発ストレージから除去することに極力努めなければならない。 MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible after forwarding it.
この指令は、プライバシーを確保するための仕組みとして,依拠可能でも, 足るものでもない。 特に、悪意的な, あるいは弱体化されたキャッシュは,この指令を認識しなかったり, 順守しないかもしれず、通信ネットワークは,盗聴に対し脆弱になるかもしれない。 This directive is NOT a reliable or sufficient mechanism for ensuring privacy. In particular, malicious or compromised caches might not recognize or obey this directive, and communications networks might be vulnerable to eavesdropping.
5.2.2.4. no-transform
no-transform 応答指令は、[
媒介者は(キャッシュを実装するかどうかに関わらず),ペイロードを形式変換してはならない
]ことを指示する。
The "no-transform" response directive indicates that an intermediary (regardless of whether it implements a cache) MUST NOT transform the payload, as defined in Section 5.7.2 of [RFC7230].
5.2.2.5. public
public 応答指令は、[
どのキャッシュも,応答を格納してよい
]ことを指示する
— 応答が[
通常はキャッシュ可能でない, あるいは
私用キャッシュにおいてのみキャッシュ可能である
]ときでも。
([
Authorization を包含する要請に対する応答
]における public の利用に関係する,追加の詳細は、§ 3.2 を見よ。
[
状態°コードが既定でキャッシュ可能であると定義されていないことに因り,通常は格納されないような応答(§ 4.2.2 を見よ)
]に, public がどう影響するかについての詳細は、§ 3 を見よ。)
The "public" response directive indicates that any cache MAY store the response, even if the response would normally be non-cacheable or cacheable only within a private cache.
(See Section 3.2 for additional details related to the use of public in response to a request containing Authorization, and Section 3 for details of how public affects responses that would normally not be stored, due to their status codes not being defined as cacheable by default; see Section 4.2.2.)
5.2.2.6. private
引数の構文: Argument syntax:
#field-name
private 応答指令は[
応答メッセージは、単独の利用者用に意図されているものであり,共用キャッシュにより格納されてはならない
]ことを指示する。
私用キャッシュは、応答を格納して,今後の要請に対しそれを再利用してよい
— 応答が通常はキャッシュ可能でないとしても。
The "private" response directive indicates that the response message is intended for a single user and MUST NOT be stored by a shared cache. A private cache MAY store the response and reuse it for later requests, even if the response would normally be non-cacheable.
private 応答指令に, 1 個以上のヘッダ名がリストされている場合、この要件は,
それらのヘッダ名に結び付けられたヘッダ値に制限される。
すなわち,共用キャッシュは、それらのヘッダ名を持つヘッダたちを格納してはならない一方で、応答メッセージの残りの部分は,格納してよい。
If the private response directive specifies one or more field-names, this requirement is limited to the field-values associated with the listed response header fields. That is, a shared cache MUST NOT store the specified field-names(s), whereas it MAY store the remainder of the response message.
引数に与え得るヘッダ名は、この仕様にて定義される各種ヘッダに制限されない。 ヘッダ名は、文字大小無視である。 The field-names given are not limited to the set of header fields defined by this specification. Field names are case-insensitive.
この指令は、引数の構文として quoted-string を利用する:
送信者は token 形を生成するべきでない(引用符が不要に見える,単独のエントリからなるリストであっても)。
This directive uses the quoted-string form of the argument syntax. A sender SHOULD NOT generate the token form (even if quoting appears not to be needed for single-entry lists).
注記:
private の利用は、応答を格納できるかどうかのみを制御する
— それは,メッセージ内容のプライバシーを確保するものではない。
また、引数をとる private 応答指令は、キャッシュからは,引数なしの private が受信されたかのように取り扱われることが多い
— すなわち,引数付きの形に対する特別な取り扱いは、広範に実装されていない。
Note: This usage of the word "private" only controls where the response can be stored; it cannot ensure the privacy of the message content. Also, private response directives with field-names are often handled by caches as if an unqualified private directive was received; i.e., the special handling for the qualified form is not widely implemented.
5.2.2.7. proxy-revalidate
proxy-revalidate 応答指令は、私用キャッシュには適用されないことを除いて,
must-revalidate 応答指令と同じ意味を持つ。
The "proxy-revalidate" response directive has the same meaning as the must-revalidate response directive, except that it does not apply to private caches.
5.2.2.8. max-age
引数の構文: Argument syntax:
delta-seconds
max-age 応答指令は、[
応答は,[
その齢が 指定された秒数を超えた後は,非新鮮になる
]と見なされる
]ことを指示する。
The "max-age" response directive indicates that the response is to be considered stale after its age is greater than the specified number of seconds.
この指令は、引数構文として token 形(例:
max-age=5
)を利用する。
送信者は、 quoted-string 形(例:
max-age="5"
)を生成するべきでない。
This directive uses the token form of the argument syntax: e.g., 'max-age=5' not 'max-age="5"'. A sender SHOULD NOT generate the quoted-string form.
5.2.2.9. s-maxage
引数の構文: Argument syntax:
delta-seconds
s-maxage 応答指令は、[
共用キャッシュにおいては、[
この指令により指定された最大齢
]が,[
max-age 指令/ Expires ヘッダ
により指定された最大齢
]を上書きする
]ことを指示する。
s-maxage 指令は、 proxy-revalidate 応答指令の意味論も含意する。
The "s-maxage" response directive indicates that, in shared caches, the maximum age specified by this directive overrides the maximum age specified by either the max-age directive or the Expires header field. The s-maxage directive also implies the semantics of the proxy-revalidate response directive.
この指令は、引数構文として token 形(例:
s-maxage=10
)を利用する。
送信者は、 quoted-string 形(例:
s-maxage="10"
)を生成するべきでない。
This directive uses the token form of the argument syntax: e.g., 's-maxage=10' not 's-maxage="10"'. A sender SHOULD NOT generate the quoted-string form.
5.2.3. キャッシュ制御拡張
Cache-Control ヘッダは[
それぞれが省略可能な値を伴い得るような, 1 個以上のキャッシュ拡張トークン
]の利用を通して拡張できる。
キャッシュは、認識できないキャッシュ指令を無視しなければならない。
The Cache-Control header field can be extended through the use of one or more cache-extension tokens, each with an optional value. A cache MUST ignore unrecognized cache directives.
キャッシュのふるまい変更を要求しない拡張( “informational” 拡張) を、他の指令の意味論を変更することなく,追加できる。 Informational extensions (those that do not require a change in cache behavior) can be added without changing the semantics of other directives.
ふるまいを変更する拡張( “behavioral” 拡張)は、[ 既存のキャッシュ指令に基づくふるまいに対する改変子として動作する ]ように — すなわち,新旧 両指令が給されたときは、次のようになるように設計されている: Behavioral extensions are designed to work by acting as modifiers to the existing base of cache directives. Both the new directive and the old directive are supplied, such that\
- 新指令を解さないアプリケーションは、既定で,旧指令により指定されるふるまいになる。 applications that do not understand the new directive will default to the behavior specified by the old directive, and\
- 新指令を解するアプリケーションは、それを,旧指令に結び付けられた要件を改変するものとして認識する。 those that understand the new directive will recognize it as modifying the requirements associated with the old directive.\
このようにして、配備されたキャッシュを非互換化することなく,既存のキャッシュ制御指令を拡張できるようになる。 In this way, extensions to the existing cache-control directives can be made without breaking deployed caches.
例えば,
private 指令に対する改変子として動作する,
community と呼ばれる,新たな応答指令を仮に考える:
それは、私用キャッシュに加えて,[
ある団体
— “community” —
のメンバ間でのみ,共有される
]ような,どのキャッシュも、応答をキャッシュすることが許容されるとする。
生成元サーバは、[
“XYZ” community が,彼らの共用キャッシュにおいて[
さもなければ private になるような応答
]を利用する
]ことを許容したいと望むなら、次のように[
XYZ を値にとる community
]を含ませる:
For example, consider a hypothetical new response directive called "community" that acts as a modifier to the private directive: in addition to private caches, any cache that is shared only by members of the named community is allowed to cache the response. An origin server wishing to allow the UCI community to use an otherwise private response in their shared cache(s) could do so by including
Cache-Control: private, community="XYZ"
そのような community キャッシュ拡張を認識するキャッシュは、その拡張に則って,そのふるまいを広げられる。
community キャッシュ拡張を認識しないキャッシュは、それを無視して, private 指令を固守することになる。
A cache that recognizes such a community cache-extension could broaden its behavior in accordance with that extension. A cache that does not recognize the community cache-extension would ignore it and adhere to the private directive.
5.3. Expires
Expires ヘッダは、[
それ以降は 応答が非新鮮になると見なされる,日時/時刻
]を与える。
鮮度のモデルについての更なる論点は、 § 4.2 を見よ。
The "Expires" header field gives the date/time after which the response is considered stale. See Section 4.2 for further discussion of the freshness model.
Expires ヘッダが在ることは[
元のリソースが,その時刻を境に変化したり, 存在するようになる/しなくなる
]ことを含意するものではない。
The presence of an Expires field does not imply that the original resource will change or cease to exist at, before, or after that time.
Expires は、
HTTP-date による時刻印を値にとる。
The Expires value is an HTTP-date timestamp, as defined in Section 7.1.1.1 of [RFC7231].
Expires=HTTP-date
例: For example
Expires: Thu, 01 Dec 1994 16:00:00 GMT
キャッシュ受信者は、形式が無効な日時を,値 "0" に解釈しなければならない
— これは、過去の時刻を表現する(すなわち, “すでに失効した”)。
A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired").
応答が
max-age 指令を伴う Cache-Control ヘッダを内包する場合、受信者は Expires ヘッダを無視しなければならない。
同様に,応答が s-maxage 指令を内包する場合、共用キャッシュ受信者は, Expires ヘッダを無視しなければならない。
いずれの場合も、 Expires の値は,もっぱら[
Cache-Control ヘッダをまだ実装していない受信者
]用に意図されたものである。
If a response includes a Cache-Control field with the max-age directive (Section 5.2.2.8), a recipient MUST ignore the Expires field. Likewise, if a response includes the s-maxage directive (Section 5.2.2.9), a shared cache recipient MUST ignore the Expires field. In both these cases, the value in Expires is only intended for recipients that have not yet implemented the Cache-Control field.
時計を備えていない生成元サーバは、
Expires ヘッダを生成してはならない
— ただし、その値が次のいずれかの値をとる場合は除く:
An origin server without a clock MUST NOT generate an Expires field unless its value\
歴史的に,HTTP は、
Expires ヘッダ値が,一年以内の未来になることを要求していた。
長い鮮度維持期間は,もはや禁制されなくなったが、
度を越して巨大な値は,問題を起こすことが判っているので(例:時刻値用の 32 ビット整数の利用に因る,時計の桁溢れ)、多くのキャッシュは,それより ずっと早くに応答を抹消する。
Historically, HTTP required the Expires field-value to be no more than a year in the future. While longer freshness lifetimes are no longer prohibited, extremely large values have been demonstrated to cause problems (e.g., clock overflows due to use of 32-bit integers for time values), and many caches will evict a response far sooner than that.
5.4. Pragma
【 このヘッダは、 この RFC の改訂 RFC 9111 により, 正式に非推奨にされた。 】
Pragma ヘッダは、 HTTP/1.0 キャッシュとの後方互換性を許容する
—
クライアントが,自身が解する no-cache 要請を指定できるようにするために( Cache-Control は、 HTTP/1.1 になるまで,定義されていなかったので)。
Pragma は,[
Cache-Control ヘッダも,要請に在る, かつ解される
]ときには、無視される。
The "Pragma" header field allows backwards compatibility with HTTP/1.0 caches, so that clients can specify a "no-cache" request that they will understand (as Cache-Control was not defined until HTTP/1.1). When the Cache-Control header field is also present and understood in a request, Pragma is ignored.
HTTP/1.0 においては、 Pragma は,[[
実装が受信者用に指定する,指令
]用の,拡張可能なヘッダ
]として定義されていた。
相互運用能を改善するため、この仕様は,そのような拡張を非推奨にする。
In HTTP/1.0, Pragma was defined as an extensible field for implementation-specified directives for recipients. This specification deprecates such extensions to improve interoperability.
Pragma= 1#pragma-directivepragma-directive= "no-cache" /extension-pragmaextension-pragma=token[ "=" (token/quoted-string) ]
要請内に
Cache-Control ヘッダが無い下では、キャッシュは,[
no-cache 要請 pragma-directive
]を[
が在ったときと同じ効果を持つ
]と見なさなければならない。
When the Cache-Control header field is not present in a request, caches MUST consider the no-cache request pragma-directive as having the same effect as if "Cache-Control: no-cache" were present (see Section 5.2.1).Cache-Control: no-cache
クライアントは、
no-cache 要請を送信するときには,
Pragma, Cache-Control 両指令を内包するべき.である
— Cache-Control に対する no-cache を,[
HTTP/1.1 キャッシュに対しては,他の Cache-Control 応答指令 要請指令†をターゲットにする
]ために,目的を以って省略する場合を除いて。
例えば、次のもの:
When sending a no-cache request, a client ought to include both the pragma and cache-control directives, unless Cache-Control: no-cache is purposefully omitted to target other Cache-Control response directives at HTTP/1.1 caches. For example:
【† 正誤表#4674 による修正(Verified: 2016-04-26 ) 】
GET / HTTP/1.1 Host: www.example.com Cache-Control: max-age=30 Pragma: no-cache
は、 HTTP/1.1 キャッシュに対しては,齢が 30 秒を超えない応答に限ってサーブするように拘束する一方で,
Cache-Control を解さない実装に対しては,キャッシュ済み応答をサーブさせなくする。
will constrain HTTP/1.1 caches to serve a response no older than 30 seconds, while precluding implementations that do not understand Cache-Control from serving a cached response.
注記:
応答においては、
Pragma:
の意味は指定されていない
— それは,応答における
no-cacheCache-Control:
に代わる依拠可能な代用を供さない。
Note: Because the meaning of "Pragma: no-cache" in responses is not specified, it does not provide a reliable replacement for "Cache-Control: no-cache" in them.no-cache
5.5. Warning
【 このヘッダは、 この RFC の改訂 RFC 9111 により, 正式に廃用にされた (この節を成す内容も,すべて除去された)。 】
Warning ヘッダは、
警告
— [
状態°コード内に反映されないこともあり得るような,メッセージの状態°や形式変換
]についての追加の情報 —
を運ぶために利用される。
この情報は、概して,[
キャッシュ処理や形式変換が適用されたため,メッセージのペイロードが不正になる可能性がある
]ことを警告するために利用される。
The "Warning" header field is used to carry additional information about the status or transformation of a message that might not be reflected in the status code. This information is typically used to warn about possible incorrectness introduced by caching operations or transformations applied to the payload of the message.
警告は、キャッシュに関係する目的にも, 他の目的にも利用できる。 警告の利用により、これらの応答は,真の失敗を表すエラー状態°コードから判別できるようになる。 Warnings can be used for other purposes, both cache-related and otherwise. The use of a warning, rather than an error status code, distinguishes these responses from true failures.
Warning ヘッダは、一般に,どのメッセージにも適用できるが、一部の warn-code はキャッシュに特有であり,応答メッセージのみに適用され得る。
Warning header fields can in general be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages.
Warning= 1#warning-valuewarning-value=warn-codeSPwarn-agentSPwarn-text[SPwarn-date]warn-code= 3DIGITwarn-agent= (uri-host[ ":"port] ) /pseudonymwarn-text=quoted-stringwarn-date=DQUOTEHTTP-dateDQUOTE
warn-agent は、
Warning ヘッダを追加しているサーバの名前, または仮名( pseudonym )である。
デバッグ時に利用するときは、単独の "-" が推奨される。
the name or pseudonym of the server adding
the Warning header field, for use in debugging
a single "-" is recommended when agent unknown
(生成元サーバもキャッシュも,)同じ応答内に,複数の警告を生成し得る
— 複数の警告間で, warn-code 番号が同じ かつ warn-text のみ相違する場合も含めて。
Multiple warnings can be generated in a response (either by the origin server or by a cache), including multiple warnings with the same warn-code number that only differ in warn-text.
UA が, 1 個以上の Warning ヘッダを受信したときには、可能な限り多くのそれらを, 応答内に現れる順序で,利用者に向けて伝えるべきである。
送信者が,複数の Warning ヘッダを生成するときには、この UA のふるまいを念頭に置いて,それらを順序付けることが奨励される。
新たな Warning ヘッダを生成する送信者は、それらを,既存の どの Warning ヘッダよりも後に付加しなければならない。
A user agent that receives one or more Warning header fields SHOULD inform the user of as many of them as possible, in the order that they appear in the response. Senders that generate multiple Warning header fields are encouraged to order them with this user agent behavior in mind. A sender that generates new Warning header fields MUST append them after any existing Warning header fields.
警告には, 3 桁の warn-code があてがわれる。
最初の桁は、[[
検証された後に Warning を格納済み応答から削除する
]ことが要求される
]かどうかを指示する:
Warnings are assigned three digit warn-codes. The first digit indicates whether the Warning is required to be deleted from a stored response after validation:
-
warn-code1xxは、応答の鮮度や検証の状態°を述べるものであり, それらは,検証後にはキャッシュにより削除されなければならない。 それらは、キャッシュによってのみ,キャッシュ済みエントリを検証するときに生成され得る — 他のどの状況においても,生成されてはならない。 • 1xx warn-codes describe the freshness or validation status of the response, and so they MUST be deleted by a cache after validation. They can only be generated by a cache when validating a cached entry, and MUST NOT be generated in any other situation. -
warn-code2xxは、検証により訂正し得ないような,表現の何らかの側面を述べる(例えば,表現の不可逆圧縮) — 検証後にキャッシュにより削除されてはならない。 ただし、全部的な応答が送信された【?】場合は,削除されなければならない。 • 2xx warn-codes describe some aspect of the representation that is not rectified by a validation (for example, a lossy compression of the representation) and they MUST NOT be deleted by a cache after validation, unless a full response is sent, in which case they MUST be.
送信者は、[[
HTTP/1.0 のみを実装することが既知である受信者
]に向けて送信されるメッセージ
]内に, 1 個以上の warn-code 1xx を生成するときには、
対応する各 warning-value 内に[
そのメッセージ内の Date ヘッダに合致する warn-date
]を内包しなければならない。
例えば:
If a sender generates one or more 1xx warn-codes in a message to be sent to a recipient known to implement only HTTP/1.0, the sender MUST include in each corresponding warning-value a warn-date that matches the Date header field in the message. For example:
HTTP/1.1 200 OK Date: Sat, 25 Aug 2012 23:34:45 GMT Warning: 112 - "network down" "Sat, 25 Aug 2012 23:34:45 GMT"
警告には,エラーについて述べる
警告テキスト( warn-text )
が付随する。
例えばログをとるためなど。
それはもっぱら助言であり,その内容は warn-code の解釈には影響しない。
Warnings have accompanying warn-text that describes the error, e.g., for logging. It is advisory only, and its content does not affect interpretation of the warn-code.
Warning ヘッダを[
利用する/評価する/表示する
]受信者は、同じメッセージ内に Date 値と異なる warn-date を受信した場合には
:そのメッセージを[
格納する/回送する/利用する
]前に,その warn-date を包含する warning-value を除外しなければならない。
これにより,受信者は、キャッシュ検証の後に,不適正に維持されていた warning-value を除外できるようになる。
このとき,すべての warning-value が除外されたならば、 Warning ヘッダも除外しなければならない。
If a recipient that uses, evaluates, or displays Warning header fields receives a warn-date that is different from the Date value in the same message, the recipient MUST exclude the warning-value containing that warn-date before storing, forwarding, or using the message. This allows recipients to exclude warning-values that were improperly retained after a cache validation. If all of the warning-values are excluded, the recipient MUST exclude the Warning header field as well.
以下の warn-code が,この仕様により定義される。
それぞれには、推奨される英語の warn-text, および
その意味の説明が伴われる。
追加の warn-code を定義するための手続きは、§ 7.2.1 にて述べる。
The following warn-codes are defined by this specification, each with a recommended warn-text in English, and a description of its meaning. The procedure for defining additional warn codes is described in Section 7.2.1.
5.5.1. Warning: 110 — Response is Stale
110キャッシュは、[ 送信されてきた応答が非新鮮である ]ときには、これを生成するべきである。 A cache SHOULD generate this whenever the sent response is stale.
5.5.2. Warning: 111 — Revalidation Failed
111キャッシュは、[[ サーバに到達できないことに因り,応答を検証する試みが失敗した ]ために,非新鮮 応答を送信する ]ときには、これを生成するべきである。 A cache SHOULD generate this when sending a stale response because an attempt to validate the response failed, due to an inability to reach the server.
5.5.3. Warning: 112 — Disconnected Operation
112キャッシュは、[ ネットワークの他の部分から,ある期間, 意図的に切断された ]場合には、これを生成するべきである。 A cache SHOULD generate this if it is intentionally disconnected from the rest of the network for a period of time.
5.5.4. Warning: 113 — Heuristic Expiration
113キャッシュは、[ 24 時間を超える鮮度維持期間を 経験的に選択した, かつ 応答の齢が 24 時間を超えている ]場合には、これを生成するべきである。 A cache SHOULD generate this if it heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours.
5.5.5. Warning: 199 — Miscellaneous Warning
199警告テキストは、[ 人利用者に呈示されたり, ログがとられる ]ような,任意な情報を内包し得る。 この警告を受信したシステムは、利用者に警告を呈示する以外に,どのような自動化された動作も してはならない。 The warning text can include arbitrary information to be presented to a human user or logged. A system receiving this warning MUST NOT take any automated action, besides presenting the warning to the user.
5.5.6. Warning: 214 — Transformation Applied
214
表現に何らかの形式変換
— [
content-coding / media-type
]を変更する, あるいは 表現データを改変する, 等々 —
を適用するプロキシは、この warn-code を応答に追加しなければならない
— 応答内にすでに現れていない限り。
This Warning code MUST be added by a proxy if it applies any transformation to the representation, such as changing the content-coding, media-type, or modifying the representation data, unless this Warning code already appears in the response.
5.5.7. Warning: 299 — Miscellaneous Persistent Warning
299警告テキストは、[ 人利用者に呈示されたり, ログがとられる ]ような,任意な情報を内包し得る。 この警告を受信したシステムは、どのような自動化された動作も してはならない。 The warning text can include arbitrary information to be presented to a human user or logged. A system receiving this warning MUST NOT take any automated action.
6. 履歴リスト
UA は、 “戻る” ボタンや履歴リストなど,そのセッションで以前に検索取得された表現を再表示するために利用できるような,履歴の仕組みを備えることが多い。 User agents often have history mechanisms, such as "Back" buttons and history lists, that can be used to redisplay a representation retrieved earlier in a session.
履歴の仕組みに鮮度のモデルが適用されるとは限らない。 すなわち、履歴の仕組みは,以前に失効した表現も表示できる。 The freshness model (Section 4.2) does not necessarily apply to history mechanisms. That is, a history mechanism can display a previous representation even if it has expired.
これは、履歴の仕組みが,[
利用者に向けて ビューが非新鮮かもしれないことを示したり,
キャッシュ指令(例:
)を尊守する
]ことを禁制するものではない。
This does not prohibit the history mechanism from telling the user that a view might be stale or from honoring cache directives (e.g., Cache-Control: no-store).Cache-Control: no-store
7. IANA 考慮点
7.1. キャッシュ指令レジストリ
キャッシュ指令用の名前空間を定義するための Hypertext Transfer Protocol (HTTP) Cache Directive Registry (HTTP キャッシュ指令レジストリ)が、新たに作成され,保守されている。 The "Hypertext Transfer Protocol (HTTP) Cache Directive Registry" defines the namespace for the cache directives. It has been created and is now maintained at <http://www.iana.org/assignments/http-cache-directives>.
7.1.1. 手続き
登録にあたっては,次のフィールドが含まれなければならない: A registration MUST include the following fields:
- キャッシュ指令 名 • Cache Directive Name
- 仕様テキストへのポインタ • Pointer to specification text
この名前空間に追加される値は、 IETF による考査を要する。 Values to be added to this namespace require IETF Review (see [RFC5226], Section 4.1).
7.1.2. 新たなキャッシュ制御指令に対する考慮点
新たな拡張指令は、次を定義することを考慮するべき.である: New extension directives ought to consider defining:
- その指令が複数個 指定されたとき,何を意味するか? What it means for a directive to be specified multiple times,
- その指令が引数をとらないのは いつか? 引数が在るときは何を意味するか? • When the directive does not take an argument, what it means when an argument is present,
- その指令が引数を要求するのは いつか? それを欠くときは何を意味するか? • When the directive requires an argument, what it means when it is missing,
- その指令は要請のみ, あるいは応答のみに特有か? 両者ともに利用できるか? • Whether the directive is specific to requests, responses, or able to be used in either.
§ 5.2.3 も見よ。 See also Section 5.2.3.
7.1.3. 登録
レジストリは、以下の登録により拡充された: The registry has been populated with the registrations below:
| 要請キャッシュ指令 | 応答キャッシュ指令 |
max-age
| max-age
|
max-stale
| — |
min-fresh
| — |
| — | must-revalidate
|
no-cache
| no-cache
|
no-store
| no-store
|
no-transform
| no-transform
|
only-if-cached
| — |
| — | private
|
| — | proxy-revalidate
|
| — | public
|
| — | s-maxage
|
stale-if-error
| stale-if-error
|
| — | stale-while-revalidate
|
+------------------------+----------------------------------+
| Cache Directive | Reference |
+------------------------+----------------------------------+
| max-age | Section 5.2.1.1, Section 5.2.2.8 |
| max-stale | Section 5.2.1.2 |
| min-fresh | Section 5.2.1.3 |
| must-revalidate | Section 5.2.2.1 |
| no-cache | Section 5.2.1.4, Section 5.2.2.2 |
| no-store | Section 5.2.1.5, Section 5.2.2.3 |
| no-transform | Section 5.2.1.6, Section 5.2.2.4 |
| only-if-cached | Section 5.2.1.7 |
| private | Section 5.2.2.6 |
| proxy-revalidate | Section 5.2.2.7 |
| public | Section 5.2.2.5 |
| s-maxage | Section 5.2.2.9 |
| stale-if-error | [RFC5861], Section 4 |
| stale-while-revalidate | [RFC5861], Section 3 |
+------------------------+----------------------------------+
7.2. warn-code レジストリ
warn-code 用の名前空間を定義するレジストリが、新たに作成され,
Hypertext Transfer Protocol( HTTP )Warn Codes
にて保守されている。
The " (HTTP) Warn Codes" registry defines the namespace for warn codes. It has been created and is now maintained at <http://www.iana.org/assignments/http-warn-codes>.
7.2.1. 手続き
登録にあたっては,次のフィールドが含まれなければならない: A registration MUST include the following fields:
-
warn-code( 3 桁) • Warn Code (3 digits) - 短い説明 • Short Description
- 仕様テキストへのポインタ • Pointer to specification text
この名前空間に追加される値は、 IETF による考査を要する。 Values to be added to this namespace require IETF Review (see [RFC5226], Section 4.1).
7.2.2. 登録
レジストリは、以下の登録により拡充された: The registry has been populated with the registrations below:
| Warn Code | 短い説明 | 【短い説明】 |
110
| Response is Stale | 応答は非新鮮 |
111
| Revalidation Failed | 再検証に失敗した |
112
| Disconnected Operation | 処理は切断された |
113
| Heuristic Expiration | 経験的失効 |
199
| Miscellaneous Warning | その他の警告 |
214
| Transformation Applied | 形式変換が適用された |
299
| Miscellaneous Persistent Warning | その他の持続的警告 |
+-----------+----------------------------------+---------------+
| Warn Code | Short Description | Reference |
+-----------+----------------------------------+---------------+
| 110 | Response is Stale | Section 5.5.1 |
| 111 | Revalidation Failed | Section 5.5.2 |
| 112 | Disconnected Operation | Section 5.5.3 |
| 113 | Heuristic Expiration | Section 5.5.4 |
| 199 | Miscellaneous Warning | Section 5.5.5 |
| 214 | Transformation Applied | Section 5.5.6 |
| 299 | Miscellaneous Persistent Warning | Section 5.5.7 |
+-----------+----------------------------------+---------------+
7.3. ヘッダ登録
HTTP ヘッダは、 Message Headers レジストリの中に登録される。 HTTP header fields are registered within the "Message Headers" registry maintained at <http://www.iana.org/assignments/message-headers/>.
この文書は、次の HTTP ヘッダを定義する。 それに伴い "Permanent Message Header Field Names" レジストリも更新された([BCP90]を見よ)。 This document defines the following HTTP header fields, so the "Permanent Message Header Field Names" registry has been updated accordingly (see [BCP90]).
| ヘッダ名 | プロトコル | 位置付け |
Age
| http | standard |
Cache-Control
| http | standard |
Expires
| http | standard |
Pragma
| http | standard |
Warning
| http | standard |
+-------------------+----------+----------+-------------+
| Header Field Name | Protocol | Status | Reference |
+-------------------+----------+----------+-------------+
| Age | http | standard | Section 5.1 |
| Cache-Control | http | standard | Section 5.2 |
| Expires | http | standard | Section 5.3 |
| Pragma | http | standard | Section 5.4 |
| Warning | http | standard | Section 5.5 |
+-------------------+----------+----------+-------------+
変更制御者は “IETF (iesg@ietf.org) — Internet Engineering Task Force” である。 The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
8. セキュリティの考慮点
この節は、[ 開発者/情報プロバイダ/利用者 ]向けに, HTTP キャッシュ処理に特有な,既知なセキュリティの懸念を伝えることを意図している。 より一般的なセキュリティの考慮点は、 HTTP メッセージ処理 [RFC7230] § 9 , および HTTP 意味論 [RFC7231] § 9 にて取り組まれている。 This section is meant to inform developers, information providers, and users of known security concerns specific to HTTP caching. More general security considerations are addressed in HTTP messaging [RFC7230] and semantics [RFC7231].
キャッシュは、脆弱性を付け加える可能性がある — キャッシュの内容は,悪意的な悪用にとって魅力的なターゲットを表現するので。 キャッシュの内容は,HTTP 要請が完了した後も持続するので、利用者からはネットワークから情報が除去されたように見えても、キャッシュに対する攻撃により,長期間 情報を露わにする。 したがって,キャッシュ内容は、敏感な情報として保護される必要がある。 Caches expose additional potential vulnerabilities, since the contents of the cache represent an attractive target for malicious exploitation. Because cache contents persist after an HTTP request is complete, an attack on the cache can reveal information long after a user believes that the information has been removed from the network. Therefore, cache contents need to be protected as sensitive information.
とりわけ,共用キャッシュ内に格納されることにより、様々な攻撃が増幅され得る — そのような “キャッシュ汚染” 攻撃は、[ 多数のクライアントに向けて悪意的なペイロードを配布する ]ようなキャッシュを利用する。 それは、攻撃者が[ 実装の欠陥, 特権拡大, その他の技法 ]を利用して,そのような応答をキャッシュの中へ挿入できるときには、とりわけ効果的になる。 キャッシュ汚染によくある攻撃路の一つは、プロキシと UA におけるメッセージ構文解析法の相違点を悪用するものである — 関連する要件については [RFC7230] § 3.3.3 を見よ。 In particular, various attacks might be amplified by being stored in a shared cache; such "cache poisoning" attacks use the cache to distribute a malicious payload to many clients, and are especially effective when an attacker can use implementation flaws, elevated privileges, or other techniques to insert such a response into a cache. One common attack vector for cache poisoning is to exploit differences in message parsing on proxies and in user agents; see Section 3.3.3 of [RFC7230] for the relevant requirements.
同様に、実装の欠陥(あるいはキャッシュ運用の誤理解)は、私用と考えられる敏感な情報(例:認証資格情報)のキャッシュ処理を導き、権限が付与されていない主体に公開されるかもしれない。 Likewise, implementation flaws (as well as misunderstanding of cache operation) might lead to caching of sensitive information (e.g., authentication credentials) that is thought to be private, exposing it to unauthorized parties.
更には、キャッシュの多用は,プライバシーの懸念ももたらし得る。 例えば、利用者 A, B がキャッシュを共有していて,利用者 A があるサイトを閲覧したなら、利用者 B は — キャッシュのおかけで,そこからのリソースがより速く読み込まれることから — 利用者 A が そのサイトに居たことを検出できるようになる。 Furthermore, the very use of a cache can bring about privacy concerns. For example, if two users share a cache, and the first one browses to a site, the second may be able to detect that the other has been to that site, because the resources from it load more quickly, thanks to the cache.
注記:
Set-Cookie 応答ヘッダ [RFC6265] は、キャッシュ処理を妨げない
— Set-Cookie ヘッダを伴うキャッシュ可能な応答は、キャッシュに対する後続の要請を満たすために利用できる(また,利用されることが多い)。
サーバには、これらの応答のキャッシュ処理を制御したいときには,適切な Cache-Control 応答ヘッダを発することが,奨励される。
Note that the Set-Cookie response header field [RFC6265] does not inhibit caching; a cacheable response with a Set-Cookie header field can be (and often is) used to satisfy subsequent requests to caches. Servers who wish to control caching of these responses are encouraged to emit appropriate Cache-Control response header fields.
9. 謝辞
【 この節の内容は、 RFC723X 共通ページ に移譲。 】 See Section 10 of [RFC7230].
10. 参照文献
【 この節の内容は、 RFC723X 共通ページ に移譲。 】
付録 A. RFC 2616 からの変更点
- 明確化のため、仕様は,相当に書き直された。 The specification has been substantially rewritten for clarity.
- 認証済み応答をキャッシュできるための条件が、明確化された。 (§ 3.2 ) The conditions under which an authenticated response can be cached have been clarified. (Section 3.2)
- 新たな状態°コードは、今や,その[ キャッシュに経験的な鮮度を利用することも許容される ]ように定義できる。 キャッシュには、今や,クエリ成分を伴う URI 用に経験的な鮮度を計算することも許容される。 (§ 4.2.2 ) New status codes can now define that caches are allowed to use heuristic freshness with them. Caches are now allowed to calculate heuristic freshness for URIs with query components. (Section 4.2.2)
- 齢を計算するためのアルゴリズムは、より非保守的にされた。 キャッシュには、今や,[ 【"GMT", "UTC" 以外の】 時間帯を伴う日時を無効であったかのように取り扱う ]ことが要求される — それを正確に推測することは可能でないので。 (§ 4.2.3 ) The algorithm for calculating age is now less conservative. Caches are now required to handle dates with time zones as if they're invalid, because it's not possible to accurately guess. (Section 4.2.3)
-
Content-Location応答ヘッダは、 もはや,[ 検証するときに,利用する適切な応答を決定する ]ためには利用されなくされた。 (§ 4.3 ) The Content-Location response header field is no longer used to determine the appropriate response to use when validating. (Section 4.3) - 利用する[ キャッシュ済みな折衝された応答 ]を選定するためのアルゴリズムは、いくつかの仕方で明確化された。 特に、今や,[ 選定用ヘッダたちを処理する際の,ヘッダに特有な正準化 ]は,明示的に許容される。 (§ 4.1 ) The algorithm for selecting a cached negotiated response to use has been clarified in several ways. In particular, it now explicitly allows header-specific canonicalization when processing selecting header fields. (Section 4.1)
- 無効化を遂行するときの DoS 攻撃の回避法に関する要件が,明確化された。 (§ 4.4 ) Requirements regarding denial-of-service attack avoidance when performing invalidation have been clarified. (Section 4.4)
- キャッシュの無効化が生じるのは、応答が成功裡に受信されたときに限られる。 (§ 4.4 ) Cache invalidation only occurs when a successful response is received. (Section 4.4)
- キャッシュ指令は、文字大小無視であると明示的に定義された。 今や、 1 個のみが予期されている所での,複数のキャッシュ指令のインスタンスの取り扱いが定義された。 (§ 5.2 ) Cache directives are explicitly defined to be case-insensitive. Handling of multiple instances of cache directives when only one is expected is now defined. (Section 5.2)
-
no-store要請指令は、応答には適用されない — すなわち,キャッシュはno-storeを伴う要請を満たせ,それを無効化しない。 (§ 5.2.1.5 ) The "no-store" request directive doesn't apply to responses; i.e., a cache can satisfy a request with no-store on it and does not invalidate it. (Section 5.2.1.5) -
引数付きの
private/no-cacheキャッシュ指令は、広範に実装されていないことが注記された — 例えば, "private=foo" は、多くのキャッシュから単純にprivateに解釈される。 加えて,引数付きno-cacheの意味が明確化された。 (§ 5.2.2 ) The qualified forms of the private and no-cache cache directives are noted to not be widely implemented; for example, "private=foo" is interpreted by many caches as simply "private". Additionally, the meaning of the qualified form of no-cache has been clarified. (Section 5.2.2) -
no-cache応答指令の意味が明確化された。 (§ 5.2.2.2 ) The "no-cache" response directive's meaning has been clarified. (Section 5.2.2.2) -
Expiresヘッダ値に対する 1 年の上限は除去され、代わりに,実用的な値を利用する理由付けが与えられた。 (§ 5.3 ) The one-year limit on Expires header field values has been removed; instead, the reasoning for using a sensible value is given. (Section 5.3) -
Pragmaヘッダは、今や,後方互換性のためのみに定義される。 将来の pragma は非推奨にされた。 (§ 5.4 ) The Pragma header field is now only defined for backwards compatibility; future pragmas are deprecated. (Section 5.4) -
Warningヘッダの生成規則と処理に関する一部の要件は緩められた — それは広範に実装されていないので。 更には、Warningヘッダは,もはや [RFC2047] 符号化法を利用せず,複数の言語も許容しない — これらの側面は実装されていないので。 (§ 5.5 ) Some requirements regarding production and processing of the Warning header fields have been relaxed, as it is not widely implemented. Furthermore, the Warning header field no longer uses RFC 2047 encoding, nor does it allow multiple languages, as these aspects were not implemented. (Section 5.5) - この仕様は、 Cache Directive, および Warn Code レジストリを導入し、新たなキャッシュ指令に対する考慮点を定義する。 (§ 7.1 , § 7.2 ) This specification introduces the Cache Directive and Warn Code Registries, and defines considerations for new cache directives. (Section 7.1 and Section 7.2)
付録 B. 取り込まれた ABNF
付録 C. 総集的 ABNF
【 付録 B, C の内容は、 総集的 ABNF に移譲。 】