我正在尝试在 Ubuntu 11.04 上安装 Rails 环境。当我启动命令时rvm install 1.9.2 --with-openssl-dir=/usr/local
,收到以下错误:
curl : (1) Protocol https not supported or disabled in libcurl
如何解决?
我正在尝试在 Ubuntu 11.04 上安装 Rails 环境。当我启动命令时rvm install 1.9.2 --with-openssl-dir=/usr/local
,收到以下错误:
curl : (1) Protocol https not supported or disabled in libcurl
如何解决?
在这里得到了 windows 的答案,它在那里说:
curl -XPUT 'http://localhost:9200/api/twittervnext/tweet'
糟糕,第一次尝试并已经出现错误:
curl: (1) Protocol 'http not supported or disabled in libcurl
这个错误的原因有点愚蠢,当你对 commands 使用单引号时,Windows 不喜欢它。所以正确的命令是:
curl –XPUT "http://localhost:9200/api/twittervnext/tweet"
我遇到了这个问题,结果发现问题之前有一个空格https
。" https://"
对比"https://"
看起来已经有很多答案了,但我面临的问题是双引号。两者之间有区别:
“
和
"
将第一个双引号更改为第二个对我有用,下面是示例 curl:
curl -X PUT -u xxx:xxx -T test.txt "https://test.com/test/test.txt"
我在尝试为 ruby 安装 rvm 时遇到了同样的问题。找到解决方案:在 root 的下载文件夹中提取 curl (tar) 后。
cd /root/Downloads/curl # step-1
./configure --with-ssl # step-2
make # step-3
make install # step-4 (if not root, use sudo before command)
就我而言,libcurl 最初不支持 HTTPS 协议。为了找出支持哪些协议,哪些不支持,我使用命令检查了 curl 版本:
curl --version
它提供的信息如下:
curl 7.50.3 (x86_64-apple-darwin15.6.0) libcurl/7.50.3 SecureTransport zlib/1.2.5
协议:dict file ftp ftps gopher http imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets
恰好不支持 https 协议的地方。
然后我重新安装 curl 并使用以下命令安装它(解压后):
./configure --with-darwinssl (在mac中启用ssl通信) make make test sudo make install
经过几分钟的工作,问题解决了!
然后我重新运行 curl version 命令,它显示:
curl 7.50.3 (x86_64-apple-darwin15.6.0) libcurl/7.50.3 SecureTransport zlib/1.2.5
协议: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..."
注意报价。它应该是双 ( "
) 而不是单 ( '
)。
使用标志 --with-darwinssl 解决了这个问题
使用 curl 源代码转到文件夹
在此处下载https://curl.haxx.se/download.html
sudo ./configure --with-darwinssl
make
make install
重新启动您的控制台,它就完成了!
这在 libcurl 常见问题解答条目“libcurl中不支持或禁用协议 xxx ”中特别提到。
为了您的高兴,我也在这里嵌入了解释:
当将 URL 传递给 curl 使用时,它可能会响应不支持或禁用特定协议。此错误消息的特殊表述方式是因为 curl 在内部没有区分是否不支持特定协议(即从未添加任何知道如何使用该协议的代码)或是否明确禁用它。curl 可以构建为仅支持给定的一组协议,然后将禁用或不支持其余协议。
请注意,如果您传递一个拼写错误的协议部分,如“htpt://example.com”,或者在不太明显的情况下,如果您在协议部分前面加上一个空格,如“ http://example ”,也会发生此错误 .com/ ”。
我的问题是由未显示的UTF符号引起的。我从浏览器复制链接(在我的情况下它是一个nginx track)并在剪贴板中得到以下内容:
$ echo -n "https://sk.ee/upload/files/ESTEID-SK_2015.pem.crt" | hexdump -C
00000000 e2 80 8b 68 74 74 70 73 3a 2f 2f 73 6b 2e 65 65 |...https://sk.ee|
00000010 2f 75 70 6c 6f 61 64 2f 66 69 6c 65 73 2f 45 53 |/upload/files/ES|
00000020 54 45 49 44 2d 53 4b 5f 32 30 31 35 2e 70 65 6d |TEID-SK_2015.pem|
00000030 2e 63 72 74 |.crt|
问题出在0xe2 0x80 0x8b
前面的顺序上https
。这个序列是一个以UTF-8编码的零宽度连接器。
在 https 网站上使用 curl 时遇到同样的错误,例如
curl https://api.dis...
正如ganesh所指出的,这是因为我的 curl 版本没有启用 ssl。返回并使用 ssl 下载版本,它工作正常。
在 url 中指定协议可能会解决您的问题。
我有一个类似的问题(使用 curl php 客户端时):
我传递的是domain.com而不是sftp://domain.com这导致了这个令人困惑的错误:
libcurl 中不支持或禁用协议“http”,耗时 0 秒。
我刚刚使用指向 openssl 1.0.2g 库文件夹和包含文件夹的配置选项重新编译了 curl,但我仍然收到此消息。当我在 curl 上执行 ldd 时,它并没有显示它使用libcrypt.so
or libssl.so
,所以我认为这一定意味着即使make
andmake install
成功且没有错误,但是 curl 没有 HTTPS 支持?配置和制作如下:
./configure --prefix=/local/scratch/PACKAGES/local --with-ssl=/local/scratch/PACKAGES/local/openssl/openssl-1.0.2g --includedir=/local/scratch/PACKAGES/local/include/openssl/openssl-1.0.2g
make
make test
make install
我应该提到的libssl.so.1
是在/local/scratch/PACKAGES/local/lib
. 目前尚不清楚该--with-ssl
选项应该指向那里还是指向 openssl 安装放置 openssl.cnf 文件的目录。我选择了后者。但如果它应该是前者,那么 make 应该会失败,并出现找不到库的错误。