Range - HTTP 编辑

The Range HTTP request header indicates the part of a document that the server should return. Several parts can be requested with one Range header at once, and the server may send back these ranges in a multipart document. If the server sends back ranges, it uses the 206Partial Content for the response. If the ranges are invalid, the server returns the 416Range Not Satisfiable error. The server can also ignore the Range header and return the whole document with a 200 status code.

Header typeRequest header
Forbidden header nameno

Syntax

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>
Range: <unit>=-<suffix-length>

Directives

<unit>
The unit in which ranges are specified. This is usually bytes.
<range-start>
An integer in the given unit indicating the beginning of the request range.
<range-end>
An integer in the given unit indicating the end of the requested range. This value is optional and, if omitted, the end of the document is taken as the end of the range.
<suffix-length>
An integer in the given unit indicating the number of units at the end of the file to return.

Examples

Requesting three ranges from the file.

Range: bytes=200-1000, 2000-6576, 19000-

Requesting the first 500 and last 500 bytes of the file. The request may be rejected by the server if the ranges overlap.

Range: bytes=0-499, -500

Specifications

SpecificationTitle
RFC 7233, section 3.1: RangeHypertext Transfer Protocol (HTTP/1.1): Range Requests

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:45 次

字数:3883

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文