Tuesday, August 20, 2013

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

To test a REST API I’m building, I decided to use curl.

From the website:

“curl is a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks.”

So after downloading the curl version for Windows, I opened a command prompt and browsed to the folder where I extracted the zip file.

I started with a simple command to invoke a PUT request to my API:

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


Anonymous said...

This error was driving me nuts: used in the console with single quotes the command worked, but inside my application after a fork() and execve() not, and I hadn't the slightest idea why this could be.

Thanks a lot!

Anonymous said...


Anonymous said...

That is just very stupid !!! how can a single quote relate to this error :D ?

Thanks man, you saved my day.

Dranzd said...

Got this problem also but the problem with mine is not the quotes or double quotes, it was an space before the http:// in my CURLOPT_URL. Got the answer from this guy: http://radamantis.tumblr.com/post/380162762/protocol-http-not-supported-or-disabled-in-libcurl-o-o.

Nathan Yeung said...

Thanks for posting this! Solved my problem!

Niraj Kumar said...

Was having a space between my curl and http statement. Removing the spacks worked. Also the double quotes was an issue too.

Dmitry said...

Thanks a lot! This solution works

Anonymous said...

Thanks...fixed my issue as well!

Anonymous said...

Thanks a lot.. Replacing single quote with double quotes worked like a charm :)

Anonymous said...

Awesome. This fixed my issue here. I just didn't think about using "Linux/Unix" syntax in Windows. Thanks for this post!

Anonymous said...

This is really helpful to know! I have been troubleshooting this error for a couple hours now and this fixed my issue. Thanks!

Anonymous said...

Perfect! worked like a charm. have been pulling hairs over this.