HTTP2 with CURL gives "Unsupported Protocol"

Curioso picture Curioso · Jun 25, 2015 · Viewed 19.7k times · Source

Having already followed the steps from here, I still have Unsupported Protocol when using curl --http2 option. Similarly, setting the CURLOPT_HTTP_VERSION to CURL_HTTP_VERSION_2_0 results in the program communicating using HTTP/1.1, not HTTP/2.

Platform: Ubuntu 15.04 on VMware Player 7.

I have installed nghttp2-1.0.4 with --prefix=/usr/local, hence the libnghttp2.* is located in /usr/local/lib.

This is the code to configure curl-7.43.0:

./configure --with-nghttp2=/usr/local

The result shows that HTTP2 is enabled:

    HTTP2 support:    enabled (nghttp2)

After make and sudo make install, the following returns Unsupported Protocol:

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

The curl version doesn't show nghttp2 is supported:

curl 7.43.0 (i686-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP

Then I followed the advise from here, that I need to have OpenSSL 1.0.2 or higher. Having installed that in /opt/openssl, I reconfigured:

./configure --with-nghttp2=/usr/local --with-ssl=/opt/openssl/lib

After make and sudo make install, all problems remain the same. Strangely enough, the curl --version still returns the same information as above, with OpenSSL/1.0.1f not yet upgraded.

Any help that allows me to successfully use the --http2 option is greatly appreciated.

Answer

dsign picture dsign · Jun 25, 2015

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.