aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/glossary/request_header
diff options
context:
space:
mode:
authorFlorian Dieminger <me@fiji-flo.de>2021-02-11 18:29:51 +0100
committerGitHub <noreply@github.com>2021-02-11 18:29:51 +0100
commit2bc5610921312613f8623f7ed347aa576689b2b6 (patch)
treef17a7a00e232c97d1335ff3cb24dbcfafacfe141 /files/zh-cn/glossary/request_header
parent964decad361766e85d928a56f0ab80af0e75c172 (diff)
parentfc56124ac4eda6b3f0349c8a16fa750f27b4c7d6 (diff)
downloadtranslated-content-2bc5610921312613f8623f7ed347aa576689b2b6.tar.gz
translated-content-2bc5610921312613f8623f7ed347aa576689b2b6.tar.bz2
translated-content-2bc5610921312613f8623f7ed347aa576689b2b6.zip
Merge pull request #32 from fiji-flo/unslugging-zh-cn
Unslugging zh cn
Diffstat (limited to 'files/zh-cn/glossary/request_header')
-rw-r--r--files/zh-cn/glossary/request_header/index.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/files/zh-cn/glossary/request_header/index.html b/files/zh-cn/glossary/request_header/index.html
new file mode 100644
index 0000000000..82c98704fc
--- /dev/null
+++ b/files/zh-cn/glossary/request_header/index.html
@@ -0,0 +1,45 @@
+---
+title: Request header(请求头)
+slug: Glossary/Request_header
+tags:
+ - HTTP
+ - 术语
+translation_of: Glossary/Request_header
+original_slug: Glossary/请求头
+---
+<p><strong>请求头</strong>是 {{glossary("header", "HTTP 头")}}的一种,它可在 HTTP 请求中使用,并且和请求主体无关 。某些请求头如 {{HTTPHeader("Accept")}}、{{HTTPHeader("Accept-Language", "Accept-*")}}、 {{HTTPHeader("If-Modified-Since", "If-*")}} 允许执行条件请求。某些请求头如:{{HTTPHeader("Cookie")}}, {{HTTPHeader("User-Agent")}} 和 {{HTTPHeader("Referer")}} 描述了请求本身以确保服务端能返回正确的响应。</p>
+
+<p>并非所有出现在请求中的 HTTP 首部都属于请求头,例如在 {{HTTPMethod("POST")}} 请求中经常出现的 <a href="https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Content-Length" title="Content-Length 是一个实体消息首部,用来指明发送给接收方的消息主体的大小,即用十进制数字表示的八位元组的数目。"><code>Content-Length</code></a> 实际上是一个代表请求主体大小的 <a href="https://developer.mozilla.org/en-US/docs/Glossary/entity_header" title="entity header: An entity header is an HTTP header describing the content of the body of the message. Entity headers are used in both, HTTP requests and responses. Headers like Content-Length, Content-Language, Content-Encoding are entity headers.">entity header</a>,虽然你也可以把它叫做请求头。</p>
+
+<p>此外,CORS 定义了一个叫做 {{glossary('simple header', 'simple headers')}} 的集合,它是请求头集合的一个子集。如果某次请求是只包含 {{glossary('simple header', 'simple header')}} 的话,则被认为是简单请求,不会触发请求预检({{glossary("preflight request", "preflight")}})。</p>
+
+<p>下面是一个 HTTP 请求的请求头:</p>
+
+<pre>GET /home.html HTTP/1.1
+Host: developer.mozilla.org
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: en-US,en;q=0.5
+Accept-Encoding: gzip, deflate, br
+Referer: https://developer.mozilla.org/testpage.html
+Connection: keep-alive
+Upgrade-Insecure-Requests: 1
+If-Modified-Since: Mon, 18 Jul 2016 02:36:04 GMT
+If-None-Match: "c561c68d0ba92bbeb8b0fff2a9199f722e3a621a"
+Cache-Control: max-age=0</pre>
+
+<p>严格来说在这个例子中的 {{HTTPHeader("Content-Length")}} 不是一个请求头,而是一个实体头({{glossary("entity header")}}):</p>
+
+<pre>POST /myform.html HTTP/1.1
+Host: developer.mozilla.org
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0
+Content-Length: 128
+</pre>
+
+<h2 id="深入了解">深入了解</h2>
+
+<h3 id="技术信息">技术信息</h3>
+
+<ul>
+ <li><a href="/zh-CN/docs/Web/HTTP/Headers">HTTP 头部列表</a></li>
+</ul>