blob: 41df9707a73c3038e1e672b19e1f079df9671fe3 (
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
|
---
title: Accept-Ranges
slug: Web/HTTP/Headers/Accept-Ranges
translation_of: Web/HTTP/Headers/Accept-Ranges
---
<div>{{HTTPSidebar}}</div>
<p>服务器使用 HTTP 响应头 <code><strong>Accept-Ranges</strong></code> 标识自身支持范围请求(partial requests)。字段的具体值用于定义范围请求的单位。</p>
<p>当浏览器发现<code> Accept-Ranges </code>头时,可以尝试<em>继续</em>中断了的下载,而不是重新开始。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">头部类型</th>
<td>{{Glossary("Response header")}}</td>
</tr>
<tr>
<th scope="row">
<p>{{Glossary("Forbidden header name")}}(禁止修改的 HTTP 头)</p>
</th>
<td>否</td>
</tr>
</tbody>
</table>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">Accept-Ranges: bytes
Accept-Ranges: none</pre>
<h2 id="指令">指令</h2>
<dl>
<dt><code>none</code></dt>
<dd>不支持任何范围请求单位,由于其等同于没有返回此头部,因此很少使用。不过一些浏览器,比如IE9,会依据该头部去禁用或者移除下载管理器的暂停按钮。</dd>
<dt><code>bytes</code></dt>
<dd>
<p>范围请求的单位是 bytes (字节)。</p>
</dd>
</dl>
<h2 id="示例">示例</h2>
<pre>Accept-Ranges: bytes
</pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">规范</th>
<th scope="col">标题</th>
</tr>
<tr>
<td>{{RFC("7233", "Accept-Ranges", "2.3")}}</td>
<td>超文本传输协议 (HTTP/1.1): 范围请求</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("http.headers.Accept-Ranges")}}</p>
<h2 id="参见">参见</h2>
<ul>
<li>{{HTTPHeader("If-Range")}}</li>
<li>{{HTTPHeader("Range")}}</li>
</ul>
|