curl和wget之间有什么区别?

时间:2016-01-07 06:27:15

标签: curl wget

curl -o mnist.zip -L http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip

curl:(7)无法连接到58.96.175.173端口7070:拒绝连接

wget -o mnist.zip http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip

成功下载了mnist.zip。

curl和wget有什么区别?为什么卷曲会被拒绝?

尝试curl -v后,我收到了以下信息。

curl -o mnist.zip -L http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip -v

* Trying 58.96.175.173... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connect to 58.96.175.173 port 7070 failed: Connection refused * Failed to connect to 58.96.175.173 port 7070: Connection refused * Closing connection 0 curl: (7) Failed to connect to 58.96.175.173 port 7070: Connection refused

但我仍然不知道为什么卷曲会被拒绝。

shell> wget http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip -d

DEBUG output created by Wget 1.15 on linux-gnu.
URI encoding = ‘UTF-8’
URI encoding = ‘UTF-8’
--2016-01-07 11:54:10--  http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip
Connecting to 58.96.175.173:7070... Closed fd 3
failed: Connection refused.
Releasing 0x0000000002598870 (new refcount 0).
Deleting unused 0x0000000002598870.

wget http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip 同样被拒绝卷曲,但wget http://webdocs.cs.ualberta.ca/~bx3/data/mnist.zip -o mnist.zip是好的。为什么?这里有什么不同?

4 个答案:

答案 0 :(得分:2)

您最好尝试分析这两个请求

使用curl -v分析您做错了什么,然后通过wget分析wget -d请求,其中显示了wget请求

发生的情况

答案 1 :(得分:0)

wget's major strong side compared to curl is its ability to download recursively.

wget is command line only. There's no lib or anything, but curl features and is powered by libcurl.

curl supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMTP, RTMP and RTSP. wget supports HTTP, HTTPS and FTP.

curl builds and runs on more platforms than wget.

wget is part of the GNU project and all copyrights are assigned to FSF. 


The curl project is entirely stand-alone and independent with no organization parenting at all

curl offers upload and sending capabilities. wget only offers plain HTTP POST support.

这是http://daniel.haxx.se/docs/curl-vs-wget.html

的原始来源

答案 2 :(得分:0)

当我删除http_proxy时,一切都变得正常了。感谢golimar

答案 3 :(得分:0)

有两个主要差异

  1. 在某些系统上,未安装wget且只有curl可用。
  2. 使用wget有一个主要优点。 wget支持递归下载,而curl则不支持。