我是新手,I've been studying字节服务的 Range
请求。我发现服务器必须发送一个字节范围,如下所示
Content-Range: bytes 734-1233/1234
最后一个字节范围。但是,当请求本身只剩下最后一个字节时,浏览器如何获取文件的最后一个字节呢?
最佳答案
当前标准为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 字节文档的最后一个字节。
关于最后一个字节的 HTTP 范围请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39697023/