3.4. If-Unmodified-Since

2 阅读1分钟

3.4. If-Unmodified-Since

rfc 7232 3.4. If-Unmodified-Since

用于当user agent又没有对应的entity-tag时( the user agent does not have an entity-tag for the representation.),实现与If-Match相同的效果。

If-Unmodified-Since被忽略的情况

  • 当request携带If-Match时(MUST)。但是如果intermediaries没有实现If-Math,则不能忽略If-Unmodified-Since。
  • 取值不是有效的HTTP-date时(MUST)。
  • cache会(can)忽略收到的If-Unmodified-Since(because it is not applicable to a stored response)

If-Unmodified-Since的时间参照

A recipient MUST interpret an If-Modified-Since field-value's timestamp in terms of the origin server's clock.

If-Modified-Since的值是指origin server上的一个时刻。另外Last-Modified的值也是指origin server上的一个时刻。

取值

If-Unmodified-Since = HTTP-date

An example of the field is:
If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT

使用场景

If-Match

evaluates condition

result = representation's last modification date <= 取值

result为false时表示验证未通过。

evaluates与method执行

参考5. Evaluation

验证不通过时返回必须(MUST)返回的code

If-Match