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

mac2022-06-30  92

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 ContentServer: nginxDate: Thu, 19 Nov 2015 07:45:13 GMTContent-Type: video/mp4Content-Length: 101Connection: keep-aliveCache-Control: max-age=630720000,publicExpires: Wed, 18 May 2033 03:33:20 GMTLast-Modified: Fri, 10 May 2013 04:57:57 GMTAccess-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 --:--:--    57root@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 OKServer: nginxDate: Thu, 19 Nov 2015 07:45:24 GMTContent-Type: video/mp4Content-Length: 98852286<-----------------------------------------------返回了整个文件的长度,不是我们请求的范围1-100,所以判定不支持分段下载。Connection: keep-aliveCache-Control: max-age=630720000,publicExpires: Wed, 18 May 2033 03:33:20 GMTLast-Modified: Fri, 10 May 2013 04:57:57 GMTAccess-Control-Allow-Origin: *

转载于:https://www.cnblogs.com/persistcat/p/4977903.html

相关资源:web大文件上传、秒传、分块上传演示c#.net
最新回复(0)