【Curl测试http2.0】

由于 CentOS 7 内置的 curl 和 libcurl 源为较旧的 7.29.0,不支持一些新特性且有安全性问题,所以需要更新一下。

在这里使用 city-fan 的更新源来更新。

一、 更新 ca-bundle
首先备份一下:

cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak

更新并替换:

curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt

二、 新增 repo 源
新增 repo:

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

内容为:

[CityFanforCurl]
name=City Fan Repo
baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
enabled=0
gpgcheck=0

更新 curl
直接使用如下命令进行更新:

yum update curl --enablerepo=CityFanforCurl -y

测试http2.0

curl --http2 -vo /dev/null  "https://www.example.com"  --resolve "www.example.com:443:IP"

> GET / HTTP/2
> Host: www.example.com
> user-agent: curl/7.70.0
> accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200 
< server: nginx
< date: Thu, 28 May 2020 00:02:42 GMT
< content-type: text/html
< content-length: 430032
< accept-ranges: bytes
< etag: "28c465b661fc10bd3048b0d83bafd969"
< last-modified: Wed, 27 May 2020 23:51:39 GMT
< set-cookie: secure=true;HttpOnly=true
< x-frame-options: SAMEORIGIN
< x-amz-id-2: PSnM9Fz7rdZq0QXWKTuXIpFVqM1YEADbtVzmXZqSrys6TIzn0QhDw/4xT59GAZypXsLQ4sM7Tp4=
< x-amz-request-id: 12112A493B7B0AEC
< x-amz-version-id: lS08YmEi2sk1lSd7J4LoVv0Hms70R_fu
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值