Jorma Turkenburg
Jorma Turkenburg

Reputation: 183

How do i get cURL to use https

I'm on Ubuntu 14.04.2 LTS. cURL's installed but does not include HTTPS as a protocol that it will use.

For example:

curl https://npmjs.org/install.sh | sh

gives me this:

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

Checking curl -V results in:

Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: IPv6 Largefile

HTTPS is missing from that list... so, how do I install cURL with support for HTTPS?

Oh, and sudo apt-get install curl is what I did to install it in the first place.

Upvotes: 4

Views: 27219

Answers (3)

Memli Restelica
Memli Restelica

Reputation: 248

There are some possibilities that your linux machine does not have libssl libraries. And curl will not configure OpenSSL because of this and the https will not be enabled.

First run the command:

apt-get install libssl-dev

After this run:

./configure --with-ssl

This worked for me

Upvotes: -1

Jorma Turkenburg
Jorma Turkenburg

Reputation: 183

I still don't know why using Aptitude installs a version without support for HTTPS but building from scratch did the trick:

git clone https://github.com/bagder/curl.git
sudo apt-get build-dep curl
cd curl
./buildconf
./configure
make
sudo make install 

Now curl -V yields

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

Oh and the reason I needed this in the first place is because NVM gave me N/A when trying to download a version of Node or get a listing of available versions with nvm ls-remote. That was caused by cURL not working for HTTPS requests.

Upvotes: 3

Max Worg
Max Worg

Reputation: 2972

Your curl version wasn't compiled with SSL support. It's actually a flag that is passed during the config phase:

./configure --with-ssl

The quickest and most complete way is to download the curl sources and compile it yourself with the --with-ssl flag. This will also ensure that your curl and SSL libraries won't be vulnerable to any of the nasty, known vulnerabilities as well. There are workarounds for using insecure versions of SSL but of course that's not recommended.

Upvotes: 4

Related Questions