我如何让 cURL 使用 https
How do i get cURL to use https
我正在使用 Ubuntu 14.04.2 LTS。 cURL 已安装,但不包括 HTTPS 作为它将使用的协议。
例如:
curl https://npmjs.org/install.sh | sh
给我这个:
curl: (1) Protocol https not supported or disabled in libcurl
检查 curl -V 结果:
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: IPv6 Largefile
该列表中缺少 HTTPS...那么,如何安装支持 HTTPS 的 cURL?
哦,sudo apt-get install curl
是我首先安装的。
您的 curl 版本未使用 SSL 支持编译。它实际上是在配置阶段传递的标志:
./configure --with-ssl
最快最完整的方法是下载带有--with-ssl
标志的curl sources and compile it yourself。这还将确保您的 curl 和 SSL 库也不会容易受到任何已知的已知漏洞的攻击。有使用不安全版本的 SSL 的解决方法,但当然不推荐这样做。
我仍然不知道为什么使用 Aptitude 安装一个不支持 HTTPS 的版本,但从头开始构建就成功了:
git clone https://github.com/bagder/curl.git
sudo apt-get build-dep curl
cd curl
./buildconf
./configure
make
sudo make install
现在curl -V
产量
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
哦,我首先需要这个的原因是因为 NVM 在尝试下载 Node 版本或使用 nvm ls-remote 获取可用版本列表时给了我 N/A。这是由于 cURL 不适用于 HTTPS 请求造成的。
您的 linux 机器可能没有 libssl 库。并且 curl 不会因此配置 OpenSSL,并且不会启用 https。
首先运行命令:
apt-get install libssl-dev
之后运行:
./configure --with-ssl
这对我有用
我正在使用 Ubuntu 14.04.2 LTS。 cURL 已安装,但不包括 HTTPS 作为它将使用的协议。
例如:
curl https://npmjs.org/install.sh | sh
给我这个:
curl: (1) Protocol https not supported or disabled in libcurl
检查 curl -V 结果:
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: IPv6 Largefile
该列表中缺少 HTTPS...那么,如何安装支持 HTTPS 的 cURL?
哦,sudo apt-get install curl
是我首先安装的。
您的 curl 版本未使用 SSL 支持编译。它实际上是在配置阶段传递的标志:
./configure --with-ssl
最快最完整的方法是下载带有--with-ssl
标志的curl sources and compile it yourself。这还将确保您的 curl 和 SSL 库也不会容易受到任何已知的已知漏洞的攻击。有使用不安全版本的 SSL 的解决方法,但当然不推荐这样做。
我仍然不知道为什么使用 Aptitude 安装一个不支持 HTTPS 的版本,但从头开始构建就成功了:
git clone https://github.com/bagder/curl.git
sudo apt-get build-dep curl
cd curl
./buildconf
./configure
make
sudo make install
现在curl -V
产量
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
哦,我首先需要这个的原因是因为 NVM 在尝试下载 Node 版本或使用 nvm ls-remote 获取可用版本列表时给了我 N/A。这是由于 cURL 不适用于 HTTPS 请求造成的。
您的 linux 机器可能没有 libssl 库。并且 curl 不会因此配置 OpenSSL,并且不会启用 https。
首先运行命令:
apt-get install libssl-dev
之后运行:
./configure --with-ssl
这对我有用