让 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. 解决使用maven的java web项目导入后出现的有关问题 -cannot be read or is not a valid ZIP file

    解决使用maven的java web项目导入后出现的有关问题 -cannot be read or is not a valid ZIP file   错误问题:虽然查找repository目录下是有 ...

  2. .net core2.x - Identity - 简介

  3. sbadmin表单事件

    Form表单 自定义表单 <from action="" method="'><!---      这里可以用表单组件快速生成表单元素哦        ...

  4. teamviewer连接未就绪的解决(Manjaro Linux)

    放假回家,想设置一下teamviewer,结果一直报错"TeamViewer not ready. Please check your connection" 查了一通,发现这个方 ...

  5. docker环境中安装node、pm2,映射项目文件守护程序

    1.docker安装完成后,获取对应版本,可自定义node版本,默认为最新版本. git pull node:<version> 2.编写Dockerfile,在文件中添加安装pm2命令. ...

  6. angular.equals()

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. Contributed to JFairy

    虽然delay了一个多月才看到,但第一次被一个开源项目正式感谢,开心. 其实写过的很多东西都有机会contr的,只是有些是公司代码...

  8. ng7 设置http proxy

    看文档 proxy.conf.json { "/api": { "target": "http://localhost:5000", &qu ...

  9. harpoxy 配置

    HAProxy是一个使用C语言编写的自由及开放源代码软件,其提供高可用性.负载均衡,以及基于TCP和HTTP的应用程序代理. HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保 ...

  10. 纯js自动批量引入js、css插件,支持自定义参数

    //autoload.js ;! function(e) { var autoload = e.autoload || {}; e.autoload = autoload; e.autoload = ...