最后一个字节的HTTP范围请求

时间:2016-09-26 07:29:47

标签: http protocols

我是新手,我一直在研究字节服务的范围请求。我发现服务器必须从此

发送字节范围
  

内容范围:字节734-1233 / 1234

表示最后一个字节范围。但是当请求本身直到最后但只有一个字节时,浏览器将如何获取文件的最后一个字节?

我一直在提及的链接:https://greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-range-latest.html

1 个答案:

答案 0 :(得分:1)

目前的标准是RFC 7233。来自2.1 Byte Ranges

The first-byte-pos value in a byte-range-spec gives the byte-offset
of the first byte in a range.  The last-byte-pos value gives the
byte-offset of the last byte in the range; that is, the byte
positions specified are inclusive.  Byte offsets start at zero.

将此应用于4.2 Content-Range中的示例:

The following are examples of Content-Range values in which the
selected representation contains a total of 1234 bytes:

o  The first 500 bytes:

     Content-Range: bytes 0-499/1234

由于范围是从零开始的,因此0是第一个字节,499是第500个。因此,1233是1234字节文档的最后一个字节。

相关问题