#?SuikaWiki/0.9 page-icon="HTTP" [[#comment]] * 仕様書から ** RFC 2068・2616 (HTTP/1.1) 14.27 If-Range > If a client has a partial copy of an entity in its cache, and wishes to have an up-to-date copy of the entire entity in its cache, it could use the Range request-header with a conditional GET (using either or both of If-Unmodified-Since and If-Match.) However, if the condition fails because the entity has been modified, the client would then have to make a second request to obtain the entire current entity-body. [[クライアント]]がその[[キャッシュ]]に[[実体]]の部分複製を持っており、 そのキャッシュに最新の完全な実体の複製を有したいと思ったら、 [CODE(HTTP)[[[Range]]]] 要求頭を [[条件付GET]] ([CODE(HTTP)[[[If-Unmodified-Since]]]] と [CODE(HTTP)[[[If-Match]]]] の一方または両方を使用) で使うことができます。しかし、実体が修正されていたがために条件が失敗したら、 クライアントは現在の完全な[[実体本体]]を得るために二番目の要求を行わなければなりません。 > The If-Range header allows a client to "short-circuit" the second request. Informally, its meaning is `if the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity[INS[']].[DEL[']] [CODE(HTTP)[If-Range]] 頭を使うと、クライアントは二番目の要求を「短絡」 できます。非公式には、この意味は「もし実体が変更されていなければ、 私が持っていない部分(群)を送ってください。そうでなければ、 新しい実体全体を送ってください。」です。 > -If-Range = "If-Range" ":" ( entity-tag | HTTP-date ) > If the client has no entity tag for an entity, but does have a Last-Modified date, it [DEL[may]] [INS[MAY]] use that date in a[INS[n]] If-Range header. (The server can distinguish between a valid HTTP-date and any form of entity-tag by examining no more than two characters.) The If-Range header [DEL[should]] [INS[SHOULD]] only be used together with a Range header, and [DEL[must]] [INS[MUST]] be ignored if the request does not include a Range header, or if the server does not support the sub-range operation. クライアントが実体の[[実体札]]を持っていないものの、 [CODE(HTTP)[[[Last-Modified]]]] 日付は持っている場合は、 この日付を [CODE(HTTP)[If-Range]] 頭で使っても'''構いません'''。 ([[サーバー]]は、妥当な [CODE(ABNF)[[[HTTP-date]]]] と任意の書式の [CODE(ABNF)[[[entity-tag]]]] を高々2文字検査すれば区別できます。 [INS[(訳注: [CODE(ABNF)[entity-tag]] は必ず [CODE(HTTP)[W/"]] または [CODE(HTTP)["]] で始まります。 [CODE(HTTP)[HTTP-date]] は必ず英数字で始まりますが、紛らわしいのは [CODE(HTTP)[Wed]] で始まる場合だけです。)]]) [CODE(HTTP)[If-Range]] 頭は [CODE(HTTP)[Range]] 頭と一緒でのみ使用する'''べき'''であり、要求が [CODE(HTTP)[Range]] 頭を含んでいない場合やサーバーは部分範囲操作に対応していない場合には無視しなければ'''なりません'''。 > If the entity tag given in the If-Range header matches the current entity tag for the entity, then the server [DEL[should]] [INS[SHOULD]] provide the specified sub-range of the entity using a 206 (Partial content) response. If the entity tag does not match, then the server [DEL[should]] [INS[SHOULD]] return the entire entity using a 200 (OK) response. [CODE(HTTP)[If-Range]] 頭に与えられた実体頭がその実体の現在の実体札と一致する時は、 サーバーはその実体の指定された部分範囲を [CODE(HTTP)[[[206]]]] (部分内容) [[応答]]を使って提供する'''べきです'''。実体札が一致しなければ、 サーバーは [CODE(HTTP)[[[200]]]] (了解) 応答を使って実体全体を返す'''べきです'''。 ** RFC の部分の License [[RFCのライセンス]] *メモ