HTTP2 with CURL gives "Unsupported Protocol"
Asked Answered
T

3

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.

Tabor answered 25/6, 2015 at 3:37 Comment(0)
C
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.

Coquette answered 25/6, 2015 at 14:8 Comment(4)
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!Tabor
As what was advised here, command sudo before ./configure. Without sudo, mine didn't work.Tabor
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 google.com curl: (1) Unsupported protocol ~~~~Hellenistic
for mac os x, it will be otool -L `which curl` Spelunker
V
3

This one really helps me set it up properly

Viscometer answered 24/5, 2019 at 11:41 Comment(1)
Thank you very much for this, it helped me install curl 7.46 with http2 support on Debian 8 today.Alkylation
L
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.

Lovesome answered 27/6, 2019 at 9:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.