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.
curl supports http2 over standard TCP via the Upgrade: header. If you do an HTTP request and ask for HTTP 2, curl will ask the server to update the connection to http2 if possible.
Since 7.47. 0, the curl tool enables HTTP/2 by default for HTTPS connections.
Running curl -V will show if your version of curl supports it. If you by some chance already know that your server speaks HTTP/2 (for example, within your own controlled environment where you know exactly what runs in your machines) you can shortcut the HTTP/2 "negotiation" with --http2-prior-knowledge .
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.
This one really helps me set it up properly
sudo make install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With