已经按照这里的步骤,我仍然Unsupported Protocol
使用curl --http2
选项.类似地,设置CURLOPT_HTTP_VERSION
到CURL_HTTP_VERSION_2_0
使用HTTP/1.1进行通信的结果在节目中,未HTTP/2.
平台:VMware Player 7上的Ubuntu 15.04.
我已经安装了nghttp2-1.0.4 --prefix=/usr/local
,因此libnghttp2.*位于/usr/local/lib
.
这是配置curl-7.43.0的代码:
./configure --with-nghttp2=/usr/local
Run Code Online (Sandbox Code Playgroud)
结果显示HTTP2已启用:
HTTP2 support: enabled (nghttp2)
Run Code Online (Sandbox Code Playgroud)
后make
和sudo make install
,以下回报Unsupported Protocol
:
curl --http2 https://http2.akamai.com
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
然后我按照这里的建议,我需要有OpenSSL 1.0.2或更高版本.在/ opt/openssl中安装后,我重新配置:
./configure --with-nghttp2=/usr/local --with-ssl=/opt/openssl/lib
Run Code Online (Sandbox Code Playgroud)
后make
和sudo make install
,所有的问题保持不变.奇怪的是,curl --version
仍然返回与上面相同的信息,OpenSSL/1.0.1f尚未升级.
任何帮助我成功使用该--http2
选项的帮助非常感谢.
显然,至少在运行时,您没有链接正确版本的curl。这就是输出libcurl / 7.38.0的意思。我的版本号更高。尝试
LD_LIBRARY_PATH=/usr/local/lib curl <whatever>
Run Code Online (Sandbox Code Playgroud)
作为您的命令。或者只是为了确保:
ldd `which curl`
Run Code Online (Sandbox Code Playgroud)
并注意列出的依赖项。
归档时间: |
|
查看次数: |
14759 次 |
最近记录: |