curl 和 Wget 的比较

  1. 云栖社区>
  2. 博客列表>
  3. 正文

curl 和 Wget 的比较

余二五 2017-11-16 17:11:00 浏览485 评论0

摘要: curl vs Wget This document started off as a blog entry, but I decided that I should better make a permanent home for this as I'm sure I'll get reasons to update and fix this as time goes by.

curl vs Wget
This document started off as a blog entry, but I decided that I should better make a permanent home for this as 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 code to 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 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.
  • Pipes. curl is more in the traditional unix-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 documented return codes for various (error) situations.
  • Single shot. 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.
  • More protocols. 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.
  • More portable. 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.
  • More SSL libraries 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 more HTTP authentication methods, and especially when you try over HTTP proxies.
  • Bidirectional. curl offers upload and sending capabilities. Wget only 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
  • Compression. curl supports gzip and inflate Content-Encoding and does automatic decompression.
Wget
  • Wget is command line only. There's no lib or anything.
  • Recursive! Wget's major strong side compared to curl is its ability to download recursively, or even just download everything that is referred to from a remote resource, be it a HTML page or a FTP directory listing.A
  • Older. Wget has traces back to 1995, while curl can be tracked back no longer than 1997.
  • Less developer activity. 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.
  • HTTP 1.0. 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).
  • GPL. Wget is 100% GPL v3. curl is MIT licensed.
  • GNU. 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 - with almost all copyrights 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 I don't include that in this comparison.
For a stricter feature by feature comparison (that also compares other similar tools), see the curl comparison table
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,如需转载请自行联系原作者

用云栖社区APP,舒服~

【云栖快讯】诚邀你用自己的技术能力来用心回答每一个问题,通过回答传承技术知识、经验、心得,问答专家期待你加入!  详情请点击

网友评论

余二五
文章21627篇 | 关注64
关注
兼容Jenkins标准,可提供快速可靠的持续集成与持续交付服务。基于容器技术和阿里云基础服务... 查看详情
通过机器学习和数据建模发现潜在的入侵和攻击威胁,帮助客户建设自己的安全监控和防御体系,从而解... 查看详情
阿里云依据网站不同的发展阶段,提供更合适的架构方案,有效降低网站的开发运维难度和整体IT成本... 查看详情
为您提供简单高效、处理能力可弹性伸缩的计算服务,帮助您快速构建更稳定、安全的应用,提升运维效... 查看详情
阿里云总监课正式启航

阿里云总监课正式启航