使用--http2.0选项与curl 7.33.0给出不支持的协议 [英] using --http2.0 option with curl 7.33.0 gives unsupported protocol

查看:1060
本文介绍了使用--http2.0选项与curl 7.33.0给出不支持的协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用centos 6.2,我需要使用curl --http2.0在服务器请求之一,但我有7.19.6,看看 http://curl.haxx.se/docs/manpage.html 告诉我--http2.0选项仅支持curl 7.33.0 ,所以为了克服这个问题,我已经安装curl 7.33.0通过遵循从 http://www.linuxfromscratch.org/blfs/view/svn/basicnet/curl.html
安装curl后,我试图使用它,但它仍然给我的错误作为 curl(1):不支持的协议,我已通过使用 curl --version 检查我的curl版本:

  curl 7.33.0(x86_64-unknown-linux-gnu)libcurl / 7.33.0 OpenSSL / 1.0.0 zlib / 1.2.3 
协议:dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
特性:AsynchDNS IPv6大文件NTLM NTLM_WB SSL libz

我需要使用这个--http2.0,但没有得到任何我怎么能这样做?
由于curl 7.19已经安装,并且我重新安装curl和更高版本,这是不是有什么问题?

解决方案

正如Daniel 邮件列表中所述:


我的计划是将http2工作放在nghttp2库上
https://github.com/tatsuhiro-t/nghttp2 )[...] HTTP2将作为libcurl术语中的功能开始,而不是作为一个单独的协议。


因此,首先您需要安装 nghttp2 手动[1]。



然后你需要在configure-时间与 - with-nghttp2

  ./ configure  - with-nghttp2 = / path / to / nghttp2 / install / dir [...] 

[1 ]:在写入README状态时,表明它未在Ubuntu中打包,因此您需要自己构建



EDIT



请参阅下面的基本说明,仅使用默认选项创建库(不是命令行工具) / p>

要构建nghttp2,首先需要安装它的要求(详情请参见 nghttp2文档页):

 #克隆nghttp2 Github repo 
yum install git

#Build essentials
yum install gcc
yum install make
yum install automake
yum install libtool

#需要构建库
yum install pkgconfig
yum install zlib-devel


$ b b

一旦完成克隆repo:

  git clone https://github.com/tatsuhiro-t/nghttp2。 git 
cd nghttp2

按照此处

  autoreconf -i 
automake
autoconf
#注意:我假设你想将它部署在/ usr / local下
#随意适应你的需求!
./configure --prefix = / usr / local
make

部署:

  make install 

如果一切正常,你需要建立libcurl 7.33.0通过小心启用nghttp2与 ./ configure --with-nghttp2 = / usr / local [.. 。]



其他



想要构建应用程序另外( nghttp ,...),你将不得不在构建nghttp2之前安装其他软件包:

  yum install openssl-devel 
yum install libevent-devel
yum install libxml2-devel
yum install jansson-devel


I am using centos 6.2, i needed to use curl --http2.0 in one of the server request, but i was having 7.19.6, after looking at http://curl.haxx.se/docs/manpage.html gives me that --http2.0 option is only supported with curl 7.33.0, so to overcome that problem, i have installed curl 7.33.0 by following the steps from http://www.linuxfromscratch.org/blfs/view/svn/basicnet/curl.html after installing curl, i have tried to use that, but it is still giving me the error as curl(1):unsupported protocol, i have checked my curl version by using: curl --version this is giving me :

curl 7.33.0 (x86_64-unknown-linux-gnu) libcurl/7.33.0 OpenSSL/1.0.0 zlib/1.2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz 

I needed to use this --http2.0 but not getting anything that how i could do that? As curl 7.19 was installed and and i reinstalled curl with higher version, does this is making any problem?

解决方案

As explained by Daniel on the mailing list:

My plan is to base the http2 work on the nghttp2 library (https://github.com/tatsuhiro-t/nghttp2) [...] HTTP2 will start as a "feature" in libcurl terms and not specifically as a separate protocol.

So first of all you need to install nghttp2 manually[1].

Then you need to explicitly enable HTTP2 support at configure-time with --with-nghttp2:

./configure --with-nghttp2=/path/to/nghttp2/install/dir [...]

[1]: at the time of writing the README states that it is not packaged in Ubuntu, so you need to build it yourself.

EDIT

Please find below basic instructions to build the library only (not the command line tool) with default options.

To build nghttp2 you first need to install its requirements (as detailed on nghttp2 documentation page):

# To clone the nghttp2 Github repo
yum install git

# Build essentials
yum install gcc
yum install make
yum install automake
yum install libtool

# Required to build the library
yum install pkgconfig
yum install zlib-devel

Once done clone the repo:

git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2

Build the library as explained here:

autoreconf -i
automake
autoconf
# Note: I assume you want to deploy it under /usr/local
# Feel free to adapt to your needs!
./configure --prefix=/usr/local
make

Then deploy it:

make install

If everything is OK you then need to build libcurl 7.33.0 by taking care to enable nghttp2 with ./configure --with-nghttp2=/usr/local [...].

Extras

If you want to build the application programs in addition (nghttp, ...) you would have to install additional packages before building nghttp2:

yum install openssl-devel
yum install libevent-devel
yum install libxml2-devel
yum install jansson-devel

这篇关于使用--http2.0选项与curl 7.33.0给出不支持的协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆