天天看点

curl 和 Wget 的比较

curl vs Wget

Please let me know if you have other thoughts or comments on this document. Email them to me or reply on the blog entry.

curl

Features and is powered by <b>libcurl</b> - a cross-platform library with a stable API that can be used by each and everyone. This difference is major since it creates a completely different attitude on how to do things internally. It is also slightly harder to make a library than a "mere" command line tool.

curl 和 Wget 的比较

<b>Return codes</b>. curl returns a range of defined and documented return codes for various (error) situations.

<b>Single shot</b>. curl is basically made to do single-shot transfers of data. It transfers just the URLs that the user specifies, and does not contain any recursive downloading logic nor any sort of HTML parser.

<b>More protocols</b>. curl supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE at the time of this writing. Wget supports HTTP, HTTPS and FTP.

<b>More portable</b>. Ironically curl builds and runs on lots of more platforms than wget, in spite of their attempts to keep things conservative. For example: OS/400, TPF and other more "exotic" platforms that aren't straight-forward unix clones.

<b>More SSL libraries</b> and SSL support. curl can be built with one out of four different SSL/TLS libraries, and it offers more control and wider support for protocol details.

curl (or rather libcurl) supports <b>more HTTP authentication</b> methods, and especially when you try over HTTP proxies.

<b>Bidirectional</b>. curl offers upload and sending capabilities. Wget only offers plain HTTP POST support.

<b>HTTP multipart/form-data</b> sending, which allows users to do HTTP "upload" and in general emulate browsers and do HTTP automation to a wider extent

<b>Compression</b>. curl supports gzip and inflate Content-Encoding and does automatic decompression.

Wget

Wget is <b>command line only</b>. There's no lib or anything.

curl 和 Wget 的比较

<b>Less developer activity</b>. While this can be debated, I consider three metrics here: mailing list activity, source code commit frequency and release frequency. Anyone following these two projects can see that the curl project has a lot higher pace in all these areas, and it has indeed been so for several years.

<b>HTTP 1.0</b>. Wget still does its HTTP operations using HTTP 1.0, and while that is still working remarkably fine and hardly ever is troublesome to the end-users, it is still a fact. curl has done HTTP 1.1 since March 2001 (while still offering optional 1.0 requests).

Wget requires <b>no extra options</b> to simply download a remote URL to a local file, while curl requires -o or -O. However trivial, this fact is often mentioned to me when people explain why they prefer downloading with wget.

Additional Stuff

Thanks

Feedback and improvements by: Micah Cowan, Olemis Lang

Updated: June 4, 2009 23:07 (Central European, Stockholm Sweden)

本文转自 h2appy  51CTO博客,原文链接:http://blog.51cto.com/h2appy/180828,如需转载请自行联系原作者

继续阅读