我看到curl
支持部分下载:
-r, --range RANGE Retrieve only the bytes within a range
例子:
curl -r 0-99 http://example.com/bar.mp4
然而,wget
能否实现类似的功能呢?
我看到curl
支持部分下载:
-r, --range RANGE Retrieve only the bytes within a range
例子:
curl -r 0-99 http://example.com/bar.mp4
然而,wget
能否实现类似的功能呢?
很遗憾wget
没有这个功能(至少在我的GNU Wget 1.10.2(Red Hat修改)
中),这非常令人讨厌。你可以使用HTTP请求发送Range头,但不起作用。
wget "http://www.example.com" -c --header="Range: bytes=0-99"
它返回
HTTP request sent, awaiting response... 206 Partial Content
Giving up.
看起来 wget 已经得到了正确的响应,但奇怪的是,它并没有完成。例如,使用详细模式输出:
HTTP request sent, awaiting response...
HTTP/1.0 206 Partial Content
Accept-Ranges: bytes
Cache-Control: max-age=604800
Content-Range: bytes 0-99/1270
Content-Type: text/html
Date: Fri, 24 Jan 2014 08:35:18 GMT
Etag: "359670651"
Expires: Fri, 31 Jan 2014 08:35:18 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (ftw/FBA9)
X-Cache: HIT
Content-Length: 100
Connection: keep-alive
Giving up.