curl vs Wget

来源:互联网 发布:百度校招面试 知乎 编辑:程序博客网 时间:2024/06/09 02:22
http://daniel.haxx.se/docs/curl-vs-wget.html

This document started off as a blogentry, but I decided that I should better make a permanent home for thisas I'm sure I'll get reasons to update and fix this as time goes by.

The main differences as I see them. Please consider my bias towards curl since after all, curl is my baby - but I have contributed codeto Wget as well.

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 libcurl - a cross-platform library witha stable API that can be used by each and everyone. This difference is majorsince it creates a completely different attitude on how to do thingsinternally. It is also slightly harder to make a library than a "mere" commandline tool.
  • Pipes. curl is more in the traditionalunix-style, it sends more stuff to stdout, and reads more from stdin in a"everything is a pipe" manner.cURL
  • Return codes. curl returns a range of defined and documentedreturn codes for various (error) situations.
  • Single shot. curl is basically made to do single-shot transfers ofdata. It transfers just the URLs that the user specifies, and does not containany recursive downloading logic nor any sort of HTML parser.
  • More protocols. curl supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP,TFTP, TELNET, DICT, LDAP, LDAPS and FILE at the time of this writing. Wgetsupports HTTP, HTTPS and FTP.
  • More portable. Ironically curl builds and runs on lots of moreplatforms than wget, in spite of their attempts to keep thingsconservative. For example: OS/400, TPF and other more "exotic" platforms thataren't straight-forward unix clones.
  • More SSL libraries and SSL support. curl can be built with one outof four different SSL/TLS libraries, and it offers more control and widersupport for protocol details.
  • curl (or rather libcurl) supports more HTTP authenticationmethods, and especially when you try over HTTP proxies.
  • Bidirectional. curl offers upload and sending capabilities. Wgetonly offers plain HTTP POST support.
  • HTTP multipart/form-data sending, which allows users to do HTTP "upload" and in general emulate browsers and do HTTP automation to a wider extent
Wget
  • Wget is command line only. There's no lib or anything.
  • Recursive! Wget's major strong side compared to curl is itsability to download recursively, or even just download everything that isreferred to from a remote resource, be it a HTML page or a FTP directorylisting.A gnu head!
  • Older. Wget has traces back to 1995, while curl can betracked back no longer than 1997.
  • Less developer activity. While this can be debated, I considerthree metrics here: mailing list activity, source code commit frequency andrelease frequency. Anyone following these two projects can see that the curlproject has a lot higher pace in all these areas, and it has indeed been sofor several years.
  • HTTP 1.0. Wget still does its HTTP operations using HTTP 1.0, andwhile that is still working remarkably fine and hardly ever is troublesome tothe end-users, it is still a fact. curl has done HTTP 1.1 since March 2001(while still offering optional 1.0 requests).
  • GPL. Wget is 100% GPL v3. curl is MIT licensed.
  • GNU. Wget is part of the GNUproject and all copyrights are assigned to FSF. The curl project is entirely stand-aloneand independent with no organization parenting at all - with almost allcopyrights owned by Daniel.
  • Wget requires no extra options 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

You may argue that I should compare uploading capabilities with wput, but that's a separate tool and Idon't include that in this comparison.

For a stricter feature by feature comparison (that also compares othersimilar tools), see the curl comparisontable

Updated: February 16, 2009 18:19 (Central European, Stockholm Sweden)

 

daniel at haxx dot .se
原创粉丝点击