【发布时间】:2015-09-11 11:54:53
【问题描述】:
已经按照here 的步骤进行操作,当使用 curl --http2 选项时,我仍然有 Unsupported Protocol。同样,将CURLOPT_HTTP_VERSION 设置为CURL_HTTP_VERSION_2_0 会导致程序使用HTTP/1.1,而不是HTTP/2 进行通信。
平台:VMware Player 7 上的 Ubuntu 15.04。
我已经用--prefix=/usr/local 安装了nghttp2-1.0.4,因此libnghttp2.* 位于/usr/local/lib。
这是配置 curl-7.43.0 的代码:
./configure --with-nghttp2=/usr/local
结果显示启用了HTTP2:
HTTP2 support: enabled (nghttp2)
在make和sudo make install之后,以下返回Unsupported Protocol:
curl --http2 https://http2.akamai.com
curl 版本不显示支持 nghttp2:
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
然后我听从了here 的建议,我需要使用 OpenSSL 1.0.2 或更高版本。在 /opt/openssl 中安装后,我重新配置:
./configure --with-nghttp2=/usr/local --with-ssl=/opt/openssl/lib
在make 和sudo make install 之后,所有问题都保持不变。奇怪的是,curl --version 仍然返回与上面相同的信息,OpenSSL/1.0.1f 尚未升级。
非常感谢任何能让我成功使用--http2 选项的帮助。
【问题讨论】: