diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/http/headers/range | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/http/headers/range')
-rw-r--r-- | files/zh-cn/web/http/headers/range/index.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/range/index.html b/files/zh-cn/web/http/headers/range/index.html new file mode 100644 index 0000000000..94e10506d8 --- /dev/null +++ b/files/zh-cn/web/http/headers/range/index.html @@ -0,0 +1,83 @@ +--- +title: Range +slug: Web/HTTP/Headers/Range +tags: + - HTTP + - HTTP首部 + - 范围请求 + - 请求首部 +translation_of: Web/HTTP/Headers/Range +--- +<div>{{HTTPSidebar}}</div> + +<p>The <strong><code>Range</code></strong> 是一个请求首部,告知服务器返回文件的哪一部分。在一个 <code>Range</code> 首部中,可以一次性请求多个部分,服务器会以 multipart 文件的形式将其返回。如果服务器返回的是范围响应,需要使用 {{HTTPStatus("206")}} <code>Partial Content</code> 状态码。假如所请求的范围不合法,那么服务器会返回 {{HTTPStatus("416")}} <code>Range Not Satisfiable</code> 状态码,表示客户端错误。服务器允许忽略 <code>Range</code> 首部,从而返回整个文件,状态码用 {{HTTPStatus("200")}} 。</p> + +<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">Range: <unit>=<range-start>- +Range: <unit>=<range-start>-<range-end> +Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end> +Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>, <range-start>-<range-end></pre> + +<h2 id="指令">指令</h2> + +<dl> + <dt><unit></dt> + <dd>范围所采用的单位,通常是字节(bytes)。</dd> +</dl> + +<dl> + <dt><range-start></dt> + <dd>一个整数,表示在特定单位下,范围的起始值。</dd> + <dt><range-end></dt> + <dd>一个整数,表示在特定单位下,范围的结束值。这个值是可选的,如果不存在,表示此范围一直延伸到文档结束。</dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre>Range: bytes=200-1000, 2000-6576, 19000- +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Title</th> + </tr> + <tr> + <td>{{RFC("7233", "Range", "3.1")}}</td> + <td>Hypertext Transfer Protocol (HTTP/1.1): Range 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.Range")}}</p> + +<h2 id="相关内容">相关内容</h2> + +<ul> + <li>{{HTTPHeader("If-Range")}}</li> + <li>{{HTTPHeader("Content-Range")}}</li> + <li>{{HTTPHeader("Content-Type")}}</li> + <li>{{HTTPStatus("206")}} <code>Partial Content</code></li> + <li>{{HTTPStatus("416")}} <code>Range Not Satisfiable</code></li> +</ul> |