blob: 5782983d6e49c134c142530da1d35d463f6283a3 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
---
title: Content-Range
slug: Web/HTTP/Headers/Content-Range
tags:
- 响应首部
- 超文本传输协议
- 首部
translation_of: Web/HTTP/Headers/Content-Range
---
<div>{{HTTPSidebar}}</div>
<p>在HTTP协议中,响应首部 <strong><code>Content-Range</code></strong> 显示的是一个数据片段在整个文件中的位置。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">Header type</th>
<td>{{Glossary("Response header")}}</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name")}}</th>
<td>no</td>
</tr>
<tr>
<th scope="row">{{Glossary("Simple response header", "CORS-safelisted response-header")}}</th>
<td>no</td>
</tr>
</tbody>
</table>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">Content-Range: <unit> <range-start>-<range-end>/<size>
Content-Range: <unit> <range-start>-<range-end>/*
Content-Range: <unit> */<size></pre>
<h2 id="指令">指令</h2>
<dl>
<dt><unit></dt>
<dd>数据区间所采用的单位。通常是字节(byte)。</dd>
</dl>
<dl>
<dt><range-start></dt>
<dd>一个整数,表示在给定单位下,区间的起始值。</dd>
<dt><range-end></dt>
<dd>一个整数,表示在给定单位下,区间的结束值。</dd>
<dt><size></dt>
<dd>整个文件的大小(如果大小未知则用"*"表示)。</dd>
</dl>
<h2 id="示例">示例</h2>
<pre>Content-Range: bytes 200-1000/67589
</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", "Content-Range", "4.2")}}</td>
<td>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("http.headers.Content-Range")}}</p>
<h2 id="相关内容">相关内容</h2>
<ul>
<li>{{HTTPHeader("If-Range")}}</li>
<li>{{HTTPHeader("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>
|