centos7 yum升级curl支持http2

post by rocdk890 / 2022-9-4 13:17 Sunday linux技术
默认的curl命令是不支持http2协议,所以下面的操作来让其支持http2.
系统:centos7.x(64位)

1.安装yum源
cat > /etc/yum.repos.d/city-fan.repo << EOF
[cityfan]  
name=cityfan 
baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
enabled=1  
gpgcheck=0
EOF

2.更新curl
yum update curl -y

3.进行验证
curl --version

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

HTTP/2 200
date: Sun, 04 Sep 2022 05:16:03 GMT
content-type: text/html
last-modified: Mon, 22 Aug 2022 12:34:53 GMT
etag: "630377ed-18b4"
accept-ranges: bytes
content-length: 6324
x-backend-header-rtt: 0.001217
strict-transport-security: max-age=31536000
server: nghttpx
alt-svc: h3=":443"; ma=3600, h3-29=":443"; ma=3600
via: 2 nghttpx
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff

或者
curl --http2 -I https://blog.slogra.com

HTTP/2 200
server: nginx
date: Sun, 04 Sep 2022 05:18:27 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
vary: Accept-Encoding
strict-transport-security: max-age=63072000
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1


可以看到curl已经支持http2了.
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-790.html

标签: centos yum curl http2

评论: