Examples of byte-ranges-specifier
values (assuming an entity-body of
length 10000):
- The first 500 bytes (byte offsets 0-499, inclusive): bytes=0-
499
- The second 500 bytes (byte offsets 500-999, inclusive):
bytes=500-999
- The final 500 bytes (byte offsets 9500-9999, inclusive):
bytes=-500
- Or bytes=9500-
- The first and last bytes only (bytes 0 and 9999): bytes=0-0,-1
- Several legal but not canonical specifications of the second
To test if a server support it you can test the accept-range as such
Origin servers that accept byte-range requests MAY send
Accept-Ranges: bytes
but are not required to do so. Clients MAY generate byte-range
requests without having received this header for the resource
involved. Range units are defined in section 3.12.
Servers that do not accept any kind of range request for a
resource MAY send
Accept-Ranges: none
to advise the client not to attempt a range request.
您应该在请求中使用
Range
头。但是只有当服务器通过Accept-Ranges
响应头通知您它接受范围请求时,才可以使用它。在这是一个示例会话。假设我们有兴趣得到this picture的一部分。首先,我们发送一个HTTP
HEAD
请求来确定:a)如果服务器支持字节范围,b)内容长度:接下来,我们发送一个
^{pr2}$GET
请求,该请求带有Range
报头,请求图片的前11个字节:这是前11个字节的十六进制转储:
有关更多信息,请参见HTTP rfc2616中的Range header specification。在
在http://www.gnu.org/software/wget/manual/wget.html
在http://tools.ietf.org/html/rfc2616
所以你应该
相关问题 更多 >
编程相关推荐