Compiling cURL with HTTP/2 support on Kali Linux 2


The cURL tool supports HTTP/2 in it’s current version 7.47, of 27th of January 2016. This version is however not yet (January 2016) distributed in Debian or Kali packages so in order to take advantage of this feature, one must take this matter into its own hands… Let’s get and compile the latest version…

Previous Post: “HTTP/2 – A very brave new World

Download of the compiled version: curl-7.47.1-dev.tar

Common dependencies

root@KALI2:~/dev> apt-get install build-essential libtool autoconf
root@KALI2:~/dev> apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev 
root@KALI2:~/dev> # apt-get install git

HTTP/2 Library

The documentation states that libcurl uses a 3rd party library for the low level protocol handling. The reason is that HTTP/2 is much more complex at that layer than HTTP/1.1, which cURL implements directly, and that nghttp2 is an already existing and functional library.

In the past, it was required to compile the nghttp2 library from the sources, but in the meantime it has been included in the official Debian packages.

root@KALI2:~/dev> apt-get install nghttp2

The correct installation can be verified like this:

root@KALI2:~/dev> ldconfig -v | grep http2

/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: ->
/lib/x86_64-linux-gnu/ is the dynamic linker, ignoring ->

Downloading and configuring cURL source repository

root@KALI2:~> # Enter your development directory
root@KALI2:~> cd dev

root@KALI2:~/dev> # Get the sources
root@KALI2:~/dev> git clone
root@KALI2:~/dev> cd curl

root@KALI2:~/dev/curl> # Build the build configuration
root@KALI2:~/dev/curl> ./buildconf

buildconf: autoconf version 2.69 (ok)
buildconf: autom4te version 2.69 (ok)
buildconf: autoheader version 2.69 (ok)
buildconf: automake version 1.14.1 (ok)
buildconf: aclocal version 1.14.1 (ok)
buildconf: libtoolize version 2.4.2 (ok)
buildconf: GNU m4 version 1.4.17 (ok)
buildconf: running libtoolize
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
libtoolize: Remember to add `LT_INIT' to
buildconf: converting all mv to mv -f in local m4/libtool.m4
buildconf: running aclocal
buildconf: converting all mv to mv -f in local aclocal.m4
buildconf: running autoheader
buildconf: running autoconf
buildconf: running automake installing './compile' installing './config.guess' installing './config.sub' installing './install-sh' installing './missing'
docs/examples/ installing './depcomp'
parallel-tests: installing './test-driver'
buildconf: OK

root@KALI2:~/dev/curl>  # Display compilation and feature options (result, see below)
root@KALI2:~/dev/curl> ./configure --help

root@KALI2:~/dev/curl> # Define what the build should execute. We activate the HTTP/2 feature
root@KALI2:~/dev/curl> # and we make sure that this version does not overwrite the local cURL
root@KALI2:~/dev/curl> # version. For this, we specify our own target directory.
root@KALI2:~/dev/curl> #
root@KALI2:~/dev/curl> # Please adapt the target directory prefix to your needs. 
root@KALI2:~/dev/curl> #
root@KALI2:~/dev/curl> # In case of problems, consult the config.log file.
root@KALI2:~/dev/curl> #
root@KALI2:~/dev/curl> ./configure --with-nghttp2 --prefix=$HOME/bin --enable-verbose --enable-ipv6 

checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
PSL support:      no      (libpsl not found)
  HTTP2 support:    enabled (nghttp2)


root@KALI2:~/dev/curl> make

Making all in lib
make[1]: Entering directory '/root/dev/curl/lib'
make  all-am
make[2]: Entering directory '/root/dev/curl/lib'
  CC       libcurl_la-file.lo
  CC       libcurl_la-timeval.lo
  CC       libcurl_la-base64.lo

root@KALI2:~/dev/curl># This builds the tool in the 'src' directory, where it can also be executed.
root@KALI2:~/dev/curl># Make sure to not to forget the './', otherwise the 'normal' cURL present in the 
root@KALI2:~/dev/curl># path is called.
root@KALI2:~/dev/curl/src> ./curl -V

root@KALI2:~/dev/curl> # Install the tool and all dependencies in the 'prefix' (see above) directory
root@KALI2:~/dev/curl> make install

Making install in lib
make[1]: Entering directory '/root/dev/curl/lib'
make[2]: Entering directory '/root/dev/curl/lib'
 /bin/mkdir -p '/root/bin/lib'
 /bin/bash ../libtool   --mode=install /usr/bin/install -c '/root/bin/lib'
libtool: install: /usr/bin/install -c .libs/ /root/bin/lib/
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /root/bin/lib
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/dev/curl/lib'
make[1]: Leaving directory '/root/dev/curl/lib'


root@KALI2:~/dev/curl> # Enter the target directory specified during the build
root@KALI2:~/dev/curl> cd ~/bin
root@KALI2:~/bin# ls -R
bin  include  lib  share

root@KALI2:~/bin> cd bin

root@KALI2:~/bin/bin> # We need to see HTTP2 in the features list and the version is 7.47.1-DEV
root@KALI2:~/bin/bin> curl -V

curl 7.47.1-DEV (x86_64-unknown-linux-gnu) libcurl/7.47.1-DEV OpenSSL/1.0.1k zlib/1.2.8 nghttp2/1.7.1-DEV
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets 

The nghttp2 library web site is also served via HTTP/2, so that’s a good place to test our tool. Note the first result line indicating HTTP/2.

root@KALI2:~/bin/bin>./curl -I 

HTTP/2.0 200
date:Sat, 30 Jan 2016 15:25:52 GMT
last-modified:Mon, 25 Jan 2016 11:01:34 GMT
link:/stylesheets/screen.css>; rel=preload; as=stylesheet
server:nghttpx nghttp2/1.7.1-DEV
via:1.1 nghttpx

Google is served using HTTP/2 as well, only on https.

root@KALI2:~/bin/bin# ./curl --http2 -I

HTTP/2.0 302
content-type:text/html; charset=UTF-8
date:Sat, 30 Jan 2016 15:29:26 GMT

Download of the compiled version: curl-7.47.1-dev.tar

2 thoughts on “Compiling cURL with HTTP/2 support on Kali Linux 2

  1. Thanks for this post.
    I had to install the libnghttp2-dev package to get HTTP2 support embedded into cURL though.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.