为啥 curl 允许使用文件 URL 方案,但不允许使用 wget

Posted

技术标签:

【中文标题】为啥 curl 允许使用文件 URL 方案,但不允许使用 wget【英文标题】:Why does curl allow use of the file URL scheme, but not wget为什么 curl 允许使用文件 URL 方案,但不允许使用 wget 【发布时间】:2012-05-13 12:49:45 【问题描述】:

这个问题是指 curl 7.21.4 和 GNU Wget 1.13.4,我不知道答案是否特定于版本。

使用file URI scheme 我可以使用curl 获取本地文件

$ curl file://localhost/Users/dave/.vimrc
contents of .vimrc

但是,如果我使用 wget 尝试相同的操作,我会收到错误:

$ wget file://localhost/Users/dave/.vimrc
file://localhost/Users/dave/.vimrc: Unsupported scheme `file'

有人知道为什么会这样吗?

【问题讨论】:

【参考方案1】:

因为尚未编写 Wget 以支持 file:// URL。 (front web page 明确指出“GNU Wget 是一个使用 HTTP、HTTPS 和 FTP 检索文件的免费软件包”)

请允许我指点一下curl vs wget comparison。

【讨论】:

【参考方案2】:

wget 仅支持 HTTP、HTTPS 和 FTP 协议。

【讨论】:

你能提供一个引用,或者为什么会这样吗?

以上是关于为啥 curl 允许使用文件 URL 方案,但不允许使用 wget的主要内容,如果未能解决你的问题,请参考以下文章