If-Modified-Since:

If-Modified-Since: ヘッダー、 If-Unmodified-Since: ヘッダー (HTTP)

[34] If-Modified-Since: ヘッダーIf-Unmodified-Since: ヘッダーは、 対象資源の最終更新日時が指定した時刻の前後いずれかによって要求メソッドの処理を実行するか否かを指定するものです。

仕様書

意味

[8] If-Modified-Since: ヘッダーIf-Unmodified-Since: ヘッダーは、 GETHEAD要求選択された表現の最終変更日時に関する条件付き要求とします >>12, >>25

[18] If-Modified-Since: は、 キャッシュされている実体タグを持たない表現を効率的に更新するために使うことができます >>12

[20] キャッシュの更新に使う時は普通はキャッシュされた Last-Modified: の値を使って If-Modified-Since:生成します。 時計の同期が不十分な場合や何らかの理由で側の Last-Modified: が過去に戻った時のためにが時刻を完全一致にしているような場合があるので、 これが最も相互運用性が高い動作です。しかし、Last-Modified: がない場合に Date: や手元の時計の時刻を使うなどして、 それ以外の時刻を生成する場合もあります。 >>12

[19] If-Modified-Since: は、 Web探索を最近の変更のみに限定するために使うことができます >>12

[21] 利用者エージェントは取得の時間範囲を限定する場合には手元の時計の次オックを使ったり、 以前の応答Date: を使ったりします。 起源鯖Last-Modified: との完全一致を行っていると、 このような利用者エージェントでのデータ転送の削減の役には立ちません。 >>12

[22] 完全一致するような起源鯖は実在するのでしょうか?

[27] If-Unmodified-Since: は、 POSTPUTDELETE のような状態を変更する要求メソッドにおいて、 別の利用者エージェントが並列に加えた変更を上書きしてしまう「lost update」 問題を避けるために使われます。 >>25

[28] If-Unmodified-Since: は、 安全なメソッドにおいて、選択された表現が既に一部または全部が蓄積されているものと一致しない時に要求を中断するために使うこともできます。 >>25

[29] 例えば既に一部をキャッシュしている資源の残りの部分を取得したい時に、 途中で変更されていたらその処理を中断したいときに使えます。

構文

[13] If-Modified-Since: ヘッダーIf-Unmodified-Since: ヘッダーの値は、 HTTPの日時形式 (HTTP-date) です >>12, >>25

  1. HTTP-date

処理モデル

[35] 条件付き要求の項を参照してください。

[26] 受信者は、If-Modified-Since:If-Unmodified-Since: の値を起源鯖時計に照らして解釈しなければなりません >>12, >>25

[14] 選択された表現の最終変更日時が If-Modified-Since: ヘッダーで指定された値と同じかそれ以前なら、 同ヘッダーの条件はと判断しないべきです>>12

[15] なぜ MUST でないのかは不明です。

[33] 選択された表現の最終変更日時が If-Unmodified-Since: ヘッダーで指定された値よりも最近なら、同ヘッダーの条件はと判断してはなりません >>25

[16] If-Unmodified-Since: は「同じかより前」、 If-Modified-Since: は「より後」で、 等しい時刻の場合の動作が異なるので注意が必要です。

歴史

[305] Request Headers in the HTTP protocol ( ( 版)) <http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#if-modified-since>

[11] RFC 2068・2616 (HTTP/1.1) 14.28 If-Unmodified-Since

The If-Unmodified-Since request-header field is used with a method to make it conditional. If the requested resource has not been modified since the time specified in this field, the server should SHOULD perform the requested operation as if the If-Unmodified-Since header were not present.

If-Unmodified-Since 要求頭欄は、それを条件付とする方式と共に使います。 要求された資源がこの欄に指定された時刻から修正されていなければ、 サーバーは、 If-Unmodified-Since 頭がなかった場合のように要求された操作を行うべきです

If the requested variant has been modified since the specified time, the server MUST NOT perform the requested operation, and MUST return a 412 (Precondition Failed).

要求された変種が指定されたい時刻より修正されているなら、 サーバーは要求された操作を行ってはならず412 (前条件失敗) を返さなければなりません

  • If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date

An example of the field is:

この欄の例:

  • If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT

If the request normally (i.e., without the If-Unmodified-Since header) would result in anything other than a 2xx or 412 status, the If-Unmodified-Since header should SHOULD be ignored.

要求が通常なら (つまり、 If-Unmodified-Since 頭がなければ) 2xx または 412 状態以外のものとなるならば、 If-Unmodified-Since 頭は無視するべきです

If the specified date is invalid, the header is ignored.

指定された日付が不当なら、この頭は無視します。

The result of a request having both an If-Unmodified-Since header field and either an If-None-Match or an If-Modified-Since header fields is undefined by this specification.

If-Unmodified-Since 頭欄ならびに If-None-Match 頭欄または If-Modified-Since 頭欄のいずれかの両者を有する要求の結果はこの仕様書では未定義とします。

[10] RFC 2326 12.23 If-Modified-Since

The If-Modified-Since request-header field is used with the DESCRIBE and SETUP methods to make them conditional. If the requested variant has not been modified since the time specified in this field, a description will not be returned from the server (DESCRIBE) or a stream will not be set up (SETUP). Instead, a 304 (not modified) response will be returned without any message-body.

[1] If-Modified-Since: 要求頭欄は、 DESCRIBE メソッドSETUP メソッドで用いて、その要求条件付とします。 要求された異体 (variant) がこの欄で指定された時刻以後修正されていないなら、 記述 (description) を返さない (DESCRIBE) か、 またはストリームを設定しません (SETUP)。 その代わりに、message-body 無しの 304 (無修正) 応答を返します。

  • [2] If-Modified-Since = "If-Modified-Since" ":" HTTP-date

An example of the field is:

  • [3] If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT

length 引数

[6] 90年代後半のWebブラウザーlength 引数If-Modified-Since: ヘッダーに含めることがありました。

[5] >>4 WinIE3.02 と NC 4.01 では確かに length 引数がつきました。

[7] Apache時間帯以降 (length も含めて) 無視するようになっているそうです。

[9] >>5 WinIE 7Firefox は (たぶん) つけないようです。

実装

[307] Last-Modified が If-Modified-Since と一致すると IE6 は他がなにあってもキャッシュを使っちゃう。 ETag とか Vary とかつけてみたけど無視される。

[413] ウェブマスター向けガイドライン - ウェブマスター ツール ヘルプ ( ( 版)) <https://support.google.com/webmasters/answer/35769?hl=ja>

[414] RFC 2660 - The Secure HyperText Transfer Protocol ( ( 版)) <http://tools.ietf.org/html/rfc2660#section-5.2.5>

[17] Server timestamps — Kinto 8.1.5 documentation () <https://kinto.readthedocs.io/en/latest/api/1.x/timestamps.html>

Changed in version 2.0: In previous versions, cache and concurrency control was handled using If-Modified-Since and If-Unmodified-Since. But since the HTTP date does not include milliseconds, they contained the milliseconds timestamp as integer. The current version using ETag is HTTP compliant (see original discussion.)