cURL – Part I

Yesterday afternoon a software developer and I were talking about some issues that came up earlier yesterday morning as a result of some updates done by a web hosting company where his software is deployed. By the time we were chatting, the hosting company had backed out from the update and he had addressed the side effects. All was back to normal.  What called my attention was a comment he made regarding cURL. For some reason the update had affected the operation of cURL. Apparently his software is heavily dependent on cURL.

On several occasions I have used curl.exe to test an API on a Restful web server. I will provide a quick overview on curl and will expand using it on future posts. That is the reason for the “Part I” in the title of this post.

So what is cURL? I found information at the, Wikipedia and a few more sites. My notes follow.

The cURL web site defines it as command line tool and library for transferring data with URLs. cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. The cURL project produces two products, libcurl and cURL.

There are two components, the command line tool curl.exe which I have used on multiple occasions and the libcurl.dll library which will be covering in future posts.

cURL is a command line tool for getting or sending files using URL syntax.

Since cURL uses libcurl, it supports a range of common Internet protocols, currently including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, DAP, DICT, TELNET, FILE, IMAP, POP3, SMTP and RTSP. I have used it for FTP, HTTP, HTTPS, SFTP and SMTP.

cURL supports HTTPS and performs SSL certificate verification by default when a secure protocol is specified such as HTTPS. When cURL connects to a remote server via HTTPS, it will first obtain the remote server certificate and check against its CA certificate store the validity of the remote server to ensure the remote server is the one it claims to be.

Some cURL packages have bundled with CA certificate store file. There are few options to specify CA certificate such as –cacert and –capath. –cacert option can be used to specify the location of the CA certificate store file.

cURL will return an error message if the remote server is using a self-signed certificate, or if the remote server certificate is not signed by a CA listed in the CA cert file. -k or –insecure option can be used to skip certificate verification. Alternatively, if the remote server is trusted, the remote server CA certificate can be added to the CA certificate store file.

libcurl is a free client-side URL transfer library, supporting FTP, FTPS, Gopher, HTTP (with HTTP/2 support), HTTPS, SCP, SFTP, TFTP, Telnet, DICT, the file URI scheme, LDAP, LDAPS, IMAP, POP3, SMTP and RTSP. The library supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, Kerberos, HTTP form-based upload, proxies, cookies, user-plus-password authentication, file transfer resume, and HTTP proxy tunneling. The libcurl library is portable. It builds and works identically on many platforms. The libcurl library is free, thread-safe and IPv6 compatible. Bindings are available for more than 40 languages, including C/C++, Java, PHP and Python.

I decided to download the latest version of the software. First I checked what I had installed on my Windows machine. From a command prompt:

C:\> curl -V
curl 7.49.0 (x86_64-pc-win32) libcurl/7.49.0 WinSSL zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz

The latest version of cURL on the site was 7.53.1 and I was running 7.49.0. Looked for the location of curl.exe and libcurl.dll and found them both in:  C:\Program Files\Anaconda3\Library\bin\ Apparently it had automatically been downloaded when I updated Anaconda last. I renamed the two files as follow:

C:\Program Files\Anaconda3\Library\bin\old_curl.exe

C:\Program Files\Anaconda3\Library\bin\old_libcurl.dll

At the page I selected the Win64 x86_64 7zip 7.53.1 binary SSL SSH 1.82 MB and downloaded to the following location in my computer:  c:\temp\curl-7.53.1-win64-mingw.7z

After extracting the downloaded files in my temp directory I found in a README.txt:

“Find out how to install Curl by reading the INSTALL document.”


The file contained the following paragraph:

“Lots of people download binary distributions of curl and libcurl. This

document does not describe how to install curl or libcurl using such a binary

package. This document describes how to compile, build and install curl and

libcurl from source code.”

I extracted the downloaded software to the following folder:  C:\Temp\curl-7.53.1-win64-mingw\curl-7.53.1-win64-mingw. I copied the last subfolder and renamed it to:  C:\Program Files (x86)\curl Finally I added the following to my Path:  C:\Program Files (x86)\curl\bin

From a command prompt:

C:\> curl -V
curl 7.53.1 (x86_64-pc-win32) libcurl/7.53.1 OpenSSL/1.1.0e zlib/1.2.11 WinIDN libssh2/1.8.0 nghttp2/1.20.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP HTTP2 HTTPS-proxy

I found the following paragraph on the cURL web site:

“You also find these examples in the distribution archive, in docs/examples.

Download, it contains all the example sources listed here.”

I downloaded the file to my machine:  c:\temp\ After extracting the contents of the archive, I copied all the *.c and *.cpp files to the following location in my computer:  C:\Program Files (x86)\curl\docs

If you have comments or questions regarding this or any other post in this blog, please do not hesitate and send me a message. Will reply as soon as possible and will not use your name unless you explicitly allow me to do so.



Follow me on Twitter:  @john_canessa

Leave a Reply

Your email address will not be published. Required fields are marked *