您的位置:首页 > 其它

curl测试断点续传功能

2017-12-26 15:31 155 查看

环境说明

使用公司的文件下载服务器,测试其断点续传功能,文件服务器采用fastdfs搭建,文件小于50M直接使用流传输,准备下载url,查询其文件大小为3208578字节,断点下载,先下载0-90000字节,再下载90000-结束字节。

root@dev:~/test# curl -H "Range: bytes=0-90000" http://192.168.96.35:8080/FileService/downloadstorefile.do?fileid=349933937 -v > test.m4a
*   Trying 192.168.96.35...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.96.35 (192.168.96.35) port 8080 (#0)
> GET /FileService/downloadstorefile.do?fileid=349933937 HTTP/1.1
> Host: 192.168.96.35:8080
> User-Agent: curl/7.47.0
> Accept: */*
> Range: bytes=0-90000
>
< HTTP/1.1 206
< Server: nginx/1.1.10
< Date: Tue, 26 Dec 2017 07:19:35 GMT
< Content-Type: application/octet-stream;charset=UTF-8
< Content-Length: 90001
< Connection: keep-alive
< Content-Disposition: attachment; filename="349933937.m4a"
< Last-Modified: Mon, 25 Dec 2017 02:37:11 GMT
< ETag: 349933937
< Accept-Ranges: bytes
< Content-Range: bytes 0-90000/3208578
<
{ [1089 bytes data]
100 90001  100 90001    0     0  4092k      0 --:--:-- --:--:-- --:--:-- 4185k
* Connection #0 to host 192.168.96.35 left intact
root@dev:~/test# ll test.m4a
-rw-r--r-- 1 root root 90001 12月 26 15:21 test.m4a
root@dev:~/test# curl -H "Range: bytes=90000-" http://192.168.96.35:8080/FileService/downloadstorefile.do?fileid=349933937 -v > test.m4a
*   Trying 192.168.96.35...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.96.35 (192.168.96.35) port 8080 (#0)
> GET /FileService/downloadstorefile.do?fileid=349933937 HTTP/1.1
> Host: 192.168.96.35:8080
> User-Agent: curl/7.47.0
> Accept: */*
> Range: bytes=90000-
>
< HTTP/1.1 206
< Server: nginx/1.1.10
< Date: Tue, 26 Dec 2017 07:19:49 GMT
< Content-Type: application/octet-stream;charset=UTF-8
< Content-Length: 3118578
< Connection: keep-alive
< Content-Disposition: attachment; filename="349933937.m4a"
< Last-Modified: Mon, 25 Dec 2017 02:37:11 GMT
< ETag: 349933937
< Accept-Ranges: bytes
< Content-Range: bytes 90000-3208577/3208578
<
{ [2529 bytes data]
100 3045k  100 3045k    0     0  10.5M      0 --:--:-- --:--:-- --:--:-- 10.5M
* Connection #0 to host 192.168.96.35 left intact
root@dev:~/test# ll test.m4a
-rw-r--r-- 1 root root 3118578 12月 26 15:22 test.m4a


可以看出文件下载服务断点功能正常,下载的文件大小一致。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  断点续传 curl