HTTP客户端如何从多部分范围中受益?

时间:2019-04-13 12:31:36

标签: http https download http-headers download-manager

我无法理解multipart ranges的用法。听起来很有趣,但以什么方式有益呢?客户如何使用这种回应?以及内容长度如何变为804?

(5−0)+(15−9)+(3587−3147)+3 = 454
$ curl -X GET -H "Range: bytes=0-5, 9-15, 3147-3587" http://dl11.f2m.io/film/The.Spy.Gone.North.2018.720p.BluRay.Film2Movie_WS.mkv
HTTP/1.1 206 Partial Content
Server: nginx
Date: Sat, 13 Apr 2019 10:48:16 GMT
Content-Type: multipart/byteranges; boundary=00000000000000000008
Content-Length: 804
Last-Modified: Sat, 13 Apr 2019 09:23:42 GMT
Connection: keep-alive
ETag: "5cb1aa9e-51539d77"

--00000000000000000008
Content-Type: application/octet-stream
Content-Range: bytes 0-5/1364434295

�Eߣ�B
--00000000000000000008
Content-Type: application/octet-stream
Content-Range: bytes 9-15/1364434295

B��B�
--00000000000000000008
Content-Type: application/octet-stream
Content-Range: bytes 3147-3587/1364434295


--00000000000000000008--

如果我想并行下载资源(线程),则可以使用多个Range请求。

$ curl -X GET -H "Range: bytes=0-5" {url}
$ curl -X GET -H "Range: bytes=9-15" {url}
$ curl -X GET -H "Range: bytes=3147-3587" {url}

那么多段量程用法是什么?

0 个答案:

没有答案