Using --Http2.0 Option with Curl 7.33.0 Gives Unsupported Protocol

using --http2.0 option with curl 7.33.0 gives unsupported protocol

As explained by Daniel on the mailing list:

My plan is to base the http2 work on the nghttp2 library
(https://github.com/tatsuhiro-t/nghttp2) [...] HTTP2 will start as a "feature" in libcurl terms and not specifically as a separate protocol.

So first of all you need to install nghttp2 manually[1].

Then you need to explicitly enable HTTP2 support at configure-time with --with-nghttp2:

./configure --with-nghttp2=/path/to/nghttp2/install/dir [...]

[1]: at the time of writing the README states that it is not packaged in Ubuntu, so you need to build it yourself.

EDIT

Please find below basic instructions to build the library only (not the command line tool) with default options.

To build nghttp2 you first need to install its requirements (as detailed on nghttp2 documentation page):

# To clone the nghttp2 Github repo
yum install git

# Build essentials
yum install gcc
yum install make
yum install automake
yum install libtool

# Required to build the library
yum install pkgconfig
yum install zlib-devel

Once done clone the repo:

git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2

Build the library as explained here:

autoreconf -i
automake
autoconf
# Note: I assume you want to deploy it under /usr/local
# Feel free to adapt to your needs!
./configure --prefix=/usr/local
make

Then deploy it:

make install

If everything is OK you then need to build libcurl 7.33.0 by taking care to enable nghttp2 with ./configure --with-nghttp2=/usr/local [...].

Extras

If you want to build the application programs in addition (nghttp, ...) you would have to install additional packages before building nghttp2:

yum install openssl-devel
yum install libevent-devel
yum install libxml2-devel
yum install jansson-devel

HTTP2 with CURL gives Unsupported Protocol

Apparently you are not linking with the right version of curl, at least at runtime. That's what the output libcurl/7.38.0 means. Mine has a higher version number there. Try

LD_LIBRARY_PATH=/usr/local/lib curl <whatever> 

as your command. Or just to be sure:

ldd `which curl` 

and pay attention to the dependencies that appear listed.

cURL is not working with nghttp2

You're probably not running the newly built curl, or your new curl build is using the previous libcurl install. Invoke 'curl --version' and make sure it lists "HTTP2" as supported (included in Features).

You also need to make sure you build curl with an TLS library version that has support for ALPN (for HTTP/2 over TLS). If you build with openssl, you need version 1.0.2 (or later).

I just tried now on https://http2.akamai.com/ and it says "You are using HTTP/2 right now!" just fine when I try my curl build on it like this:

$ curl --http2 -kv https://http2.akamai.com/ 

You can view the verbose output and you should see the ALPN offer and what protocol curl and the server agree on using.



Related Topics



Leave a reply



Submit