测试源站(web server)是否支持分段下载

root@b-ThinkPad-X230s:~# curl -D - -o /dev/null "http://ec8.images-amazon.com/images/I/G1SkhOwB6aS.mp4" -H "Range:bytes=0-100" -x 203.81.17.140:80
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0HTTP/1.1 206 Partial Content
Server: nginx
Date: Thu, 19 Nov 2015 07:45:13 GMT
Content-Type: video/mp4
Content-Length: 101
Connection: keep-alive
Cache-Control: max-age=630720000,public
Expires: Wed, 18 May 2033 03:33:20 GMT
Last-Modified: Fri, 10 May 2013 04:57:57 GMT
Access-Control-Allow-Origin: *
Content-Range: bytes 0-100/98852286

注意:Range:bytes=0-100 是从0开始的,只要是从0开始肯定是支持的,所以这点是测试不出是否支持分段下载

然后调整范围:Range:bytes=1-100



100   101  100   101    0     0     57      0  0:00:01  0:00:01 --:--:--    57
root@b-ThinkPad-X230s:~# curl -D - -o /dev/null "http://ec8.images-amazon.com/images/I/G1SkhOwB6aS.mp4" -H "Range:bytes=1-100" -x 203.81.17.140:80
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0HTTP/1.1 200 OK
Server: nginx
Date: Thu, 19 Nov 2015 07:45:24 GMT
Content-Type: video/mp4
Content-Length: 98852286<-----------------------------------------------返回了整个文件的长度,不是我们请求的范围1-100,所以判定不支持分段下载。
Connection: keep-alive
Cache-Control: max-age=630720000,public
Expires: Wed, 18 May 2033 03:33:20 GMT
Last-Modified: Fri, 10 May 2013 04:57:57 GMT
Access-Control-Allow-Origin: *

posted @ 2015-11-19 15:55  su_yang  阅读(341)  评论(0编辑  收藏  举报