通过cURL下载文件失败,而使用chrome则可以

通过cURL下载文件失败,而使用chrome则可以,curl,Curl,即使在阅读了大量的答案后,我仍然找不到解决问题的办法。因此,我再次提出这个问题 我正在尝试使用下面的命令下载 curl -o tcp.pdf --cookie coockie -L http://index-of.es/Magazines/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf --verbose 输出: $ curl -o tcp.pdf --cookie coockie -L http://index-of.es/M

即使在阅读了大量的答案后,我仍然找不到解决问题的办法。因此,我再次提出这个问题

我正在尝试使用下面的命令下载

curl  -o tcp.pdf   --cookie coockie -L  http://index-of.es/Magazines/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf
--verbose
输出:

$ curl  -o tcp.pdf   --cookie coockie -L  http://index-of.es/Magazines/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf   --verbose
* Adding handle: conn: 0xb65698
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0xb65698) send_pipe: 1, recv_pipe: 0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* About to connect() to index-of.es port 80 (#0)
*   Trying 87.98.231.4...
* Connected to index-of.es (87.98.231.4) port 80 (#0)
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0> GET /Magazines/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf HTTP/1.1
> User-Agent: curl/7.30.0
> Host: index-of.es
> Accept: */*
> Cookie: 240plan=R130020614; 240planBAK=R2339305415
>
< HTTP/1.1 302 Found
* Replaced cookie 240plan="R130020614" for domain index-of.es, path /, expire 1500391330
< Set-Cookie: 240plan=R130020614; path=/; expires=Tue, 18-Jul-2017 15:22:10 GMT
< Date: Tue, 18 Jul 2017 14:20:33 GMT
* Server Apache is not blacklisted
< Server: Apache
< Location: http://index-of.es/
< Vary: Accept-Encoding
< Content-Length: 203
< Content-Type: text/html; charset=iso-8859-1
< X-IPLB-Instance: 177
<
* Ignoring the response-body
{ [data not shown]
100   203  100   203    0     0    166      0  0:00:01  0:00:01 --:--:--   169
* Connection #0 to host index-of.es left intact
* Issue another request to this URL: 'http://index-of.es/'
$curl-o tcp.pdf--cookie coockie-Lhttp://index-of.es/Magazines/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf   --冗长的
*正在添加句柄:conn:0xb65698
*正在添加句柄:发送:0
*正在添加句柄:recv:0
*卷曲度加把手尺寸线:长度:1
*-Conn 0(0xb65698)发送管道:1,接收管道:0
%总接收百分比%x平均速度时间电流
数据加载上载总左速度
0 0 0 0 0 0--:-:---:---:---:---0*即将()连接到index-of.es端口80(#0)
*正在尝试87.98.231.4。。。
*连接到index-of.es(87.98.231.4)端口80(#0)
0 0 0 0 0 0 0--:-:-:-:-:---0>GET/magazies/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf HTTP/1.1
>用户代理:curl/7.30.0
>主持人:index-of.es
>接受:*/*
>Cookie:240plan=R130020614;240planBAK=R2339305415
>
找到
我怀疑问题在于位置:在HTTP响应中返回,这是不完整的,cURL递归地尝试连接到同一位置,结果是“cURL:(47)最多(50)次重定向。”

问题:

  • chrome如何下载该文件? 如果我使用的命令不完整,还需要向该命令添加什么

似乎
Curl
用户代理已被该服务器列入黑名单,请更改
用户代理
标题:

curl -o tcp.pdf \
     -H "User-Agent: Mozilla" \
     -L "http://index-of.es/Magazines/hakin9/books/No.Starch.TCP.IP.Guide.Oct.2005.pdf"