預設的curl指令是不支援http2協定,所以下面的操作來讓其支援http2.系統:centos7.x(64位元)
一、添加 city-fan.org 的源
# 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
二、更新curl
# yum update curl
三、測試,發現curl已精更新了,可支援http2
引用:
curl 8.2.1 (x86_64-redhat-linux-gnu) libcurl/8.2.1 NSS/3.67 zlib/1.2.7 libpsl/0.20.2 (+libidn2/2.3.2) libssh2/1.11.0 nghttp2/1.33.0 OpenLDAP/2.4.44
Release-Date: 2023-07-26
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL UnixSockets
測試指令
# curl -I https://www.google.com