aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/status/412/index.html
blob: c06e8824e994a0e4d6c98fe763f45f516972d9be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: 412 Precondition Failed
slug: Web/HTTP/Status/412
tags:
  - Error
  - HTTP
  - 参考
  - 状态码
translation_of: Web/HTTP/Status/412
---
<div>{{HTTPSidebar}}</div>

<p>在 HTTP 协议中,响应状态码 <strong>412 Precondition Failed</strong>(先决条件失败)表示客户端错误,意味着对于目标资源的访问请求被拒绝。这通常发生于采用除 {{HTTPMethod("GET")}}{{HTTPMethod("HEAD")}} 之外的方法进行条件请求时,由首部字段 {{HTTPHeader("If-Unmodified-Since")}}{{HTTPHeader("If-None-Match")}} 规定的先决条件不成立的情况下。这时候,请求的操作——通常是上传或修改文件——无法执行,从而返回该错误状态码。</p>

<h2 id="状态码">状态码</h2>

<pre class="syntaxbox">412 Precondition Failed</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", "412 Precondition Failed" , "4.2")}}</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.status.412")}}</p>

<h2 id="参见">参见</h2>

<ul>
 <li>{{HTTPStatus("304")}}</li>
 <li>{{HTTPHeader("If-Unmodified-Since")}}</li>
 <li>{{HTTPHeader("If-None-Match")}}</li>
 <li>{{HTTPStatus("428")}}</li>
</ul>