我正在尝试在Ubuntu 11.04上安装Rails环境。当我启动命令rvm install 1.9.2——with-openssl-dir=/usr/local时,收到以下错误:

curl : (1) Protocol https not supported or disabled in libcurl

如何解决这个问题?


当前回答

看起来已经有这么多答案了,但我面临的问题是双引号。 这两者之间有区别:

and

"

将第一个双引号改为第二个对我有用,下面是示例curl:

curl -X PUT -u xxx:xxx -T test.txt "https://test.com/test/test.txt"

其他回答

我遇到了这个问题,原来在https之前有一个空格,导致了这个问题。“Https://”vs“Https://”

看起来已经有这么多答案了,但我面临的问题是双引号。 这两者之间有区别:

and

"

将第一个双引号改为第二个对我有用,下面是示例curl:

curl -X PUT -u xxx:xxx -T test.txt "https://test.com/test/test.txt"

在libcurl常见问题解答条目“libcurl不支持或禁用协议xxx”中特别提到了这一点。

为了让你开心,我在这里也嵌入了解释:

When passing on a URL to curl to use, it may respond that the particular protocol is not supported or disabled. The particular way this error message is phrased is because curl doesn't make a distinction internally of whether a particular protocol is not supported (ie never got any code added that knows how to speak that protocol) or if it was explicitly disabled. curl can be built to only support a given set of protocols, and the rest would then be disabled or not supported. Note that this error will also occur if you pass a wrongly spelled protocol part as in "htpt://example.com" or as in the less evident case if you prefix the protocol part with a space as in " http://example.com/".

在我的例子中,libcurl首先不支持HTTPS协议。为了找出哪些协议被支持,哪些协议不被支持,我使用命令检查了curl版本:

curl --version

它提供的资料如下: libcurl/7.50.3 SecureTransport zlib/1.2.5 . zip (x86_64-苹果-达尔文15.6.0 协议类型:dict文件ftp ftps gopher http imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 特性:IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets

恰好不支持HTTPS协议。

然后我重新安装curl,并使用以下命令安装它(在解包后):

./configure——with-darwinssl(在mac中启用SSL通信) 使 做测试 Sudo make install

经过几分钟的工作,问题解决了!

然后我重新运行curl version命令,它显示:

libcurl/7.50.3 SecureTransport zlib/1.2.5 . zip (x86_64-苹果-达尔文15.6.0 协议类型:dict文件ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 特性:IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets

HTTPS协议出现了!

最后,当您遇到curl问题时,可以参考一个有用的站点。 https://curl.haxx.se/docs/install.html

我只需要修改“http://webname…”变成“http://webname……”

注意这句话。它应该是double(")而不是single(')。