aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/headers/if-unmodified-since
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/http/headers/if-unmodified-since
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/http/headers/if-unmodified-since')
-rw-r--r--files/zh-cn/web/http/headers/if-unmodified-since/index.html96
1 files changed, 96 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/if-unmodified-since/index.html b/files/zh-cn/web/http/headers/if-unmodified-since/index.html
new file mode 100644
index 0000000000..13655c04db
--- /dev/null
+++ b/files/zh-cn/web/http/headers/if-unmodified-since/index.html
@@ -0,0 +1,96 @@
+---
+title: If-Unmodified-Since
+slug: Web/HTTP/Headers/If-Unmodified-Since
+tags:
+ - HTTP
+ - 条件请求
+ - 请求首部
+translation_of: Web/HTTP/Headers/If-Unmodified-Since
+---
+<div>{{HTTPSidebar}}</div>
+
+<p>HTTP协议中的 <strong><code>If-Unmodified-Since</code></strong> 消息头用于请求之中,使得当前请求成为条件式请求:只有当资源在指定的时间之后没有进行过修改的情况下,服务器才会返回请求的资源,或是接受 {{HTTPMethod("POST")}} 或其他 non-{{Glossary("safe")}} 方法的请求。如果所请求的资源在指定的时间之后发生了修改,那么会返回 {{HTTPStatus("412")}} (Precondition Failed) 错误。</p>
+
+<p>常见的应用场景有两种:</p>
+
+<ul>
+ <li>与 non-{{Glossary("safe")}} 方法如 {{HTTPMethod("POST")}} 搭配使用,可以用来<a href="https://en.wikipedia.org/wiki/Optimistic_concurrency_control">优化并发控制</a>,例如在某些wiki应用中的做法:假如在原始副本获取之后,服务器上所存储的文档已经被修改,那么对其作出的编辑会被拒绝提交。</li>
+ <li>与含有 {{HTTPHeader("If-Range")}} 消息头的范围请求搭配使用,用来确保新的请求片段来自于未经修改的文档。</li>
+</ul>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">Header type</th>
+ <td>{{Glossary("Request header")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Forbidden header name")}}</th>
+ <td>no</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">If-Unmodified-Since: &lt;day-name&gt;, &lt;day&gt; &lt;month&gt; &lt;year&gt; &lt;hour&gt;:&lt;minute&gt;:&lt;second&gt; GMT
+</pre>
+
+<h2 id="指令">指令</h2>
+
+<dl>
+ <dt>&lt;day-name&gt;</dt>
+ <dd> "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 或 "Sun" 之一 (区分大小写)。</dd>
+ <dt>&lt;day&gt;</dt>
+ <dd>两位数字表示的天数, 例如"04" or "23"。</dd>
+ <dt>&lt;month&gt;</dt>
+ <dd>"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" 之一(区分大小写)。</dd>
+ <dt>&lt;year&gt;</dt>
+ <dd>4位数字表示的年份, 例如 "1990" 或者"2016"。</dd>
+ <dt>&lt;hour&gt;</dt>
+ <dd>两位数字表示的小时数, 例如 "09" 或者 "23"。</dd>
+ <dt>&lt;minute&gt;</dt>
+ <dd>两位数字表示的分钟数,例如"04" 或者 "59"。</dd>
+ <dt>&lt;second&gt;</dt>
+ <dd>两位数字表示的秒数,例如 "04" 或者 "59"。</dd>
+ <dt><code>GMT</code></dt>
+ <dd>
+ <p>国际标准时间。HTTP中的时间均用国际标准时间表示,从来不使用当地时间。</p>
+ </dd>
+</dl>
+
+<h2 id="示例">示例</h2>
+
+<pre>If-Unmodified-Since: Wed, 21 Oct 2015 07:28:00 GMT
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Title</th>
+ </tr>
+ <tr>
+ <td>{{RFC("7232", "If-Unmodified-Since", "3.4")}}</td>
+ <td>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("http.headers.If-Unmodified-Since")}}</p>
+
+<h2 id="相关内容">相关内容</h2>
+
+<ul>
+ <li>{{HTTPHeader("If-Unmodified-since")}}</li>
+ <li>{{HTTPHeader("If-Match")}}</li>
+ <li>{{HTTPHeader("If-None-Match")}}</li>
+ <li>{{HTTPHeader("If-Range")}}</li>
+ <li>{{HTTPStatus("412")}}<code> Precondition Failed</code></li>
+</ul>