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

Pra*_*wal 2 protocols http

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

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

对于最后一个字节范围。但是当请求本身到最后一个字节时,浏览器如何获取文件的最后一个字节?

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

Joe*_*Joe 5

当前标准是RFC 7233。从2.1 字节范围

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.
Run Code Online (Sandbox Code Playgroud)

将此应用于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
Run Code Online (Sandbox Code Playgroud)

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

  • 谢谢你。所以 Content-Length 是文件的实际大小。 (2认同)