258

I'm trying to install the Rails environments on Ubuntu 11.04. When I launch the command rvm install 1.9.2 --with-openssl-dir=/usr/local the following error is received:

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

How can this be resolved?

5
  • What happens if you don't use --with-openssl-dir=/usr/local (i.e. simply rvm install 1.9.2)?
    – Omri Barel
    Jul 30, 2011 at 17:45
  • the same problem, I tought that --with... was a workaround Jul 30, 2011 at 17:47
  • 1
    I find it hard to believe that your curl doesn't support HTTPS. It's possible that rvm comes with its own curl, or that you didn't install curl (sudo apt-get install curl). Try curl -o "google.html" https://google.com to check if HTTPS is supported.
    – Omri Barel
    Jul 30, 2011 at 17:51
  • I'm having the same error message with RCurl. Feb 16, 2013 at 0:07
  • surprised there's not an accepted answer on this one.
    – jbrahy
    Apr 15, 2016 at 21:11

13 Answers 13

514

Got the answer HERE for windows, it says there that:

curl -XPUT 'http://localhost:9200/api/twittervnext/tweet'

Woops, first try and already an error:

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

The reason for this error is kind of stupid, Windows doesn’t like it when you are using single quotes for commands. So the correct command is:

curl –XPUT "http://localhost:9200/api/twittervnext/tweet"
7
  • 2
    use Windows SSL-enabled cURL curl.haxx.se/latest.cgi?curl=win64-ssl-sspi instead if none of the other provided answers works for windows.
    – ganesh
    Jan 8, 2015 at 16:54
  • 12
    this is correct, and just to add a bit of salt, if you want to actually use the double quotes in the string you are quoting, then you need to escape them eg: curl "http://localhost:3030/messages/" -H "Content-Type: application/json" --data-binary "{ \"name\":\"Curler\", \"text\": \"Hello from the command line\" }" instead of curl "http://localhost:3030/messages/" -H "Content-Type: application/json" --data-binary '{ "name":"Curler", "text": "Hello from the command line" }'... take note of the single and unescaped double quotes on the wrong part. Dec 5, 2017 at 20:54
  • 1
    @EmmanuelMahuni Thanks for the clue. I was running into the same issue while trying to CURL from bitbucket pipeline, my value includes double quotes (") (as i'm reading from json response from aws cli using jq), once after removing the double from start and end. it worked for me. Here is how i did it. new_url=$( echo $url | tr -d \" ) May 25, 2019 at 17:32
  • 1
    Having the same effect with curl on macOS.
    – not2savvy
    Jan 25, 2020 at 19:29
  • 1
    Double quotes confirmed. =)
    – Ususipse
    Aug 10, 2020 at 16:13
113

I ran into this problem and turned out that there was a space before the https which was causing the problem. " https://" vs "https://"

6
  • 7
    And I got same. I was surprised why the hell on the earth I am getting this error. :) +1 for sharing this. Dec 15, 2015 at 13:25
  • 3
    Similar for me, it was a single quote because we had wrapped a default bash value with single quote although it wasn't necessary... Sep 7, 2017 at 15:59
  • 1
    It's amazing that this was apparently a problem for so many people - myself included. This thing happens from time to time, but it seems kind of obscure. Ah well. Thanks
    – dgo
    Dec 7, 2017 at 23:33
  • 1
    That was the issue for me. Thanks @jbrahy
    – colecmc
    Mar 1, 2019 at 17:49
  • 1
    Yes I got the same. By removing space it worked well for me. Jan 7, 2020 at 12:30
53

Looks like there are so many Answers already but the issue I faced was with double quotes. There is a difference in between:

and

"

Changing the 1 st double quote to the second worked for me, below is the sample curl:

curl -X PUT -u xxx:xxx -T test.txt "https://test.com/test/test.txt"
5
  • Sure thing my Man.
    – Pavan_Obj
    May 31, 2019 at 20:41
  • This one fixed my problem. Sep 26, 2019 at 5:29
  • Glad it fixed :).
    – Pavan_Obj
    Sep 26, 2019 at 19:52
  • fixed it for me too. Had not seen this error for other curl requests with https in the past so was wondering
    – Anupam
    Jul 27, 2020 at 5:16
  • Good to know Anupam
    – Pavan_Obj
    Aug 4, 2020 at 18:08
15

I encountered the same problem while trying to install rvm for ruby. found the solution: after extracting curl (tar) in downloads folder of root.

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)

source

0
13

In my case, HTTPS protocol was not supported by libcurl at the first place. To find out which protocols are supported and which are not, I checked the curl version using command:

curl --version

It provided information as follows: curl 7.50.3 (x86_64-apple-darwin15.6.0) libcurl/7.50.3 SecureTransport zlib/1.2.5 Protocols: 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

where https protocol happens to be not supported.

Then I re-installed curl and installed it using the following commands(after unpacked):

./configure --with-darwinssl (enable ssl communication in mac) make make test sudo make install

And after several minutes of work, Problems resolved!

Then I re-run the curl version command, it showed:

curl 7.50.3 (x86_64-apple-darwin15.6.0) libcurl/7.50.3 SecureTransport zlib/1.2.5 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets

HTTPS protocol showed up!

Finally, a useful site to refer when you run into curl problems. https://curl.haxx.se/docs/install.html

12

I solve it just by changing 'http://webname...' to "http://webname..."

Notice the quote. It should be double (") instead of single (').

1
  • yes! This solved the issue for me, running curl in my windows command prompt. Thank you!
    – Ryano
    Aug 15, 2019 at 1:09
10

Solved this problem with flag --with-darwinssl

Go to folder with curl source code

Download it here https://curl.haxx.se/download.html

sudo ./configure --with-darwinssl
make
make install

restart your console and it is done!

7

This is specifically mentioned in the libcurl FAQ entry "Protocol xxx not supported or disabled in libcurl".

For your pleasure I'm embedding the explanation here too:

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/".

3
  • 23
    I don't believe this answer explains to the OP what s/he needs to do to fix the problem. Feb 16, 2013 at 0:33
  • 3
    it explains what the message means, which implies that his command line wasn't enough to build libcurl with HTTPS enabled Feb 16, 2013 at 12:58
  • Got bit by the space prefix. If only the error read 'Protocol "xxx" not supported or disabled in libcurl'
    – topher
    Jul 23, 2014 at 16:15
4

My problem was coused by not displayed UTF symbol. I copy the link from the browser (in my case it was an nginx track) and got the following in clipboard:

$ 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|

The problem is in the sequence 0xe2 0x80 0x8b, which precedes https. This sequence is a ZERO WIDTH JOINER encoded in UTF-8.

1

Got the same error when using curl on https site like

curl https://api.dis...

as pointed out by ganesh, it was because my version of curl wasn't ssl enabled. went back and downloaded the version with ssl and it worked fine.

2
  • 2
    So did I, didn't see the SSL option on the download page. Oct 21, 2015 at 14:43
  • how to install the ssl version on centos 7?
    – Awan
    Jul 21 at 3:26
0

I just recompiled curl with configure options pointing to the openssl 1.0.2g library folder and include folder, and I still get this message. When I do ldd on curl, it does not show that it uses either libcrypt.so or libssl.so, so I assume this must mean that even though the make and make install succeeded without errors, nevertheless curl does not have HTTPS support? Configure and make was as follows:

./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

I should mention that libssl.so.1 is in /local/scratch/PACKAGES/local/lib. It is unclear whether the --with-ssl option should point there or to the directory where the openssl install placed the openssl.cnf file. I chose the latter. But if it were supposed to be the former, the make should have failed with an error that it couldn't find the library.

1
  • The link text itself is correct. curl cannot retrieve using https, and I don't know why.
    – tedtoal
    Mar 30, 2016 at 16:40
0

Specifying the protocol within the url might solve your problem.

I had a similar problem (while using curl php client) :

I was passing domain.com instead of sftp://domain.com which lead to this confusing error:

Protocol "http" not supported or disabled in libcurl, took 0 seconds.

0

to build CURL, you need ssl library first, so the curl binary can run with SSL embedded

Ok, let's go:

apt install libssl-dev
wget https://curl.se/download/curl-7.52.1.zip
unzip curl-7.52.1.zip
cd curl-7.52.1
make
make install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.