码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-11-19 16:24:42      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

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: *

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

标签:

原文地址:http://www.cnblogs.com/persistcat/p/4977903.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!