curl测试断点续传功能

环境说明

使用公司的文件下载服务器,测试其断点续传功能,文件服务器采用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

可以看出文件下载服务断点功能正常,下载的文件大小一致。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值