20

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.

gturri
  • 13,807
  • 9
  • 40
  • 57
Curioso
  • 343
  • 1
  • 3
  • 7

3 Answers3

6

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.

dsign
  • 12,340
  • 6
  • 59
  • 82
  • 1
    The second command above shows that I'm still using the default library /lib/i386-liux-gnu. Setting the library path as the first code above fixed the problem. Curl is now speaking http2. Thanks! – Curioso Jun 26 '15 at 12:17
  • As what was advised [here](http://stackoverflow.com/questions/12636536/install-curl-with-openssl), command `sudo` before `./configure`. Without `sudo`, mine didn't work. – Curioso Jun 29 '15 at 03:05
  • I'm still having problems. ~~~~ autoreconf -i automake autoconf sudo ./configure --prefix=/usr/local sudo make sudo make install LD_LIBRARY_PATH=/usr/local/lib curl --http2 http://google.com curl: (1) Unsupported protocol ~~~~ – Jeff Silverman Aug 06 '16 at 23:54
  • 2
    for mac os x, it will be ```otool -L `which curl` ``` – CodeGroover Jan 31 '17 at 09:03
3

This one really helps me set it up properly

khushbu
  • 158
  • 11
  • Thank you very much for this, it helped me install curl 7.46 with http2 support on Debian 8 today. – Sudavar Apr 13 '21 at 14:22
1

I found curl 7.53.1 for Windows this tool very useful to test the http2 requests. It has pre-compiled builds of curl for Windows built with OpenSSL, ngttp2, zlib & IPv6 support.

DEVAS
  • 344
  • 2
  • 12