让 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. C# .Net String字符串效率提高-字符串拼接

    字符串操作是编程中非常频繁的操作,特别是在拼接字符串的时候.下面来说说字符串拼接的效率提升. 1. 减少装箱 值类型与引用类型之间的转换存在装箱与拆箱操作:将值类型转换成引用类型的操作叫装箱,将引用类 ...

  2. 小程序 -- ui布局

    Flex布局 相对定位和绝对定位 弹性盒模型 display flex-direction flex-wrap  :nowrap(不换行)/ wrap(换行,第一行在上方)/ wrap-reverse ...

  3. 使用java的Calendar工具类获取到本月的第一天起始时间和最后一天结束时间。

    1.使用java的Calendar工具类获取到本月的第一天起始时间和最后一天结束时间. package com.fline.aic.utils; import java.text.DateFormat ...

  4. powershell 激活WIN10

    1.以win10专业版为例,鼠标右键点击开始图标,选择[windows powershell(管理员)],或者命令提示符管理员:2.打开命令窗口,复制这个命令slmgr /ipk W269N-WFGW ...

  5. James Munkres Topology: Theorem 20.4

    Theorem 20.4 The uniform topology on \(\mathbb{R}^J\) is finer than the product topology and coarser ...

  6. day16匿名函数

    匿名函数,好像也就是 lambda 表达式 先来看一段函数,返回 def func(n): return n * 3 print(func(5))15 用lambda表达式写: func = lamb ...

  7. 习题集1b: 额外练习 (可选)

    1.练习:4.样本特点 用来描述样本的数字叫做? □ 参数   (√)□ 统计量 □ 变量 □ 常数 2.练习:5.大一学生体重情况 Freidman 博士在一所大学任教,她记录了所在大学每位大一新生 ...

  8. django——模型层之单表

    1.ORM简介 MVC或者MVC框架中包括一个重要的部分,就是ORM,它实现了数据模型与数据库的解耦,即数据模型的设计不需要依赖于特定的数据库,通过简单的配置就可以轻松更换数据库,这极大的减轻了开发人 ...

  9. XVII Open Cup named after E.V. Pankratiev. GP of Siberia, Division 1

    1. Ski race 枚举枚举倍数判断即可.时间复杂度$O(n\log m)$. #include<cstdio> #include<algorithm> using nam ...

  10. The POM for cn.e3mall:e3mall-common:jar:0.0.1-SNAPSHOT is missing, no dependency information available

    [WARNING] The POM for cn.e3mall:e3mall-common:jar:0.0.1-SNAPSHOT is missing, no dependency informati ...