让 curl 支持 HTTP2 我们需要安装 nghttp2(http2 的 C 语言库)

源码安装

安装 nghttp2

git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2
autoreconf -i
automake
autoconf
./configure
make
sudo make install

编译 curl

wget http://curl.haxx.se/download/curl-7.46.0.tar.bz2
tar -xvjf curl-7.46.0.tar.bz2
cd curl-7.46.0
./configure --with-nghttp2=/usr/local --with-ssl
sudo make && make install 编译时注意观察
HTTP2 support: enabled (nghttp2) echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
ldconfig

验证

curl --version
curl 7.64.1 (x86_64-pc-linux-gnu) libcurl/7.64.1 OpenSSL/1.0.2k zlib/1.2.7 nghttp2/1.38.0-DEV
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets

测试

curl --http2 -I https://nghttp2.org

HTTP/2 200
date: Mon, 15 Apr 2019 12:53:49 GMT
content-type: text/html
last-modified: Fri, 08 Mar 2019 12:33:02 GMT
etag: "5c8260fe-19d8"
accept-ranges: bytes
content-length: 6616
x-backend-header-rtt: 0.011655
strict-transport-security: max-age=31536000
server: nghttpx
via: 2 nghttpx
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff

附注

 -I, --head 	(HTTP/FTP/FILE) Fetch the HTTP-header only!

yum 安装

安装 yum 源

rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel7.noarch.rpm

新建 yum 源(功能与 安装 yum 源 相同)

vim /etc/yum.repos.d/city-fan.repo

[cityfan]
name=cityfan
baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
enabled=1
gpgcheck=0

更新curl

yum update curl

curl 支持 http2的更多相关文章

  1. yum升级curl支持http2测试

    首先,先为你的服务器获取最新匹配的源:http://mirror.city-fan.org/ftp/contrib/yum-repo/ 方法1,rpm方式安装city-fan.org的yum源 # 安 ...

  2. yum安装curl支持http2

    yum 安装 安装 yum 源 rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rh ...

  3. 支持HTTP2的cURL——基于Alpine的最小化Docker镜像

    cURL是我喜欢的开源软件之一.虽然cURL的强大常常被认为是理所当然的,但我真心地认为它值得感谢和尊重.如果我们的工具箱失去了curl,那些需要和网络重度交互的人(我们大多数人都是这样的)将会陷入到 ...

  4. nginx支持HTTP2的配置过程

    一.获取安装包 http://zlib.net/zlib-1.2.11.tar.gz https://www.openssl.org/source/openssl-1.0.2e.tar.gz (ope ...

  5. nginx支持http2协议

    1.http2协议 HTTP 2.0 的主要目标是改进传输性能,实现低延迟和高吞吐量.从另一方面看,HTTP 的高层协议语义并不会因为这次版本升级而受影响.所有HTTP 首部.值,以及它们的使用场景都 ...

  6. 从零开始搭建支持http2的web服务

    前段时间开始,公司各项业务开始陆续接入http2,关于http2的优点与所适用的场景网上有很多的文档可以查阅,这里我主要是总结分享一下如何从0到1搭建http2服务. 这里先说明一下,要完成http2 ...

  7. nginx配置支持http2

    1.简介 nginx 配置支持http2.目前大多数网站都是http1.1(如果你没有特别配置过的话) 一切都是为了访问更快. 2.如何查看自己网站的http版本 最简单的方法就F12啊,我这里是火狐 ...

  8. CentOS 6.8 curl支持的NSS修改为OpenSSL的方法

    在CentOS 6.8的系统里面的curl支持的https是nss版本的,而不是openssl,所以在php使用curl访问https的时候会报Unable to load client key -8 ...

  9. Openresty支持HTTP2

    1. 下载openresty-1.13.6.1.tar.gz和openssl-1.0.2l.tar.gz,并解压 下载对应的软件版本,创建openresty_http2安装路径 2. 安装openre ...

随机推荐

  1. [原创]FPGA JTAG工具设计(二)

    经过前期打样 基于FT2232H的JTAG &UART板级已经初步形成 在Viado环境和ISE(13.2+)环境可以使用 速度支持10MHz/15MHz/30MHz 在ISE iMpact下 ...

  2. c++ ignore用法

    转自  http://blog.sina.com.cn/s/blog_4b3336c50102v45n.html std::cin.ignore() can be called three diffe ...

  3. numpy的索引-【老鱼学numpy】

    简单的索引值 import numpy as np a = np.arange(3, 15).reshape(3, 4) print("a=") print(a) print(&q ...

  4. Sicily T-primes

    DescriptionWe know that prime numbers are positive integers that have exactly two distinct positive  ...

  5. CSS-Sass

    什么是css预处理器

  6. python实现的跳点寻路算法(JPS)

    原理参考论文 代码已提交到git(https://github.com/YYRise/find_path/blob/master/jps.py)

  7. TypeScript系列 - 什么是TypeScript

    看了很多关于TypeScript的文章,总体说来没有很好的,一个系统的学习TypeScript的资源. 接下来,我将给大家带来TypeScript的系列,让你和我一样,一步一步的学习TypeScrip ...

  8. [LeetCode] Rabbits in Forest 森林里的兔子

    In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how ...

  9. spring-boot+mybatisPlus+shiro的集成demo 我用了5天

    spring-boot + mybatis-plus + shiro 的集成demo我用了五天 关于shiro框架,我还是从飞机哪里听来的,就连小贱都知道,可我母鸡啊.简单百度了下,结论很好上手,比s ...

  10. Python函数中的列表

    在看21天的Python书中写出了一个陷阱,但没给出解释,以下为代码陷阱