当前位置:   article > 正文

curl 支持 http2_curl http2

curl http2

源码安装

安装 nghttp2

  1. git clone https://github.com/tatsuhiro-t/nghttp2.git
  2. cd nghttp2
  3. autoreconf -i
  4. automake
  5. autoconf
  6. ./configure
  7. make
  8. sudo make install

编译 curl

  1. wget http://curl.haxx.se/download/curl-7.46.0.tar.bz2
  2. tar -xvjf curl-7.46.0.tar.bz2
  3. cd curl-7.46.0
  4. ./configure --with-nghttp2=/usr/local --with-ssl
  5. sudo make && make install
  6. 编译时注意观察
  7. HTTP2 support: enabled (nghttp2)
  8. echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
  9. ldconfig

验证

  1. curl --version
  2. 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
  3. Release-Date: 2019-03-27
  4. Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
  5. Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets

测试

  1. curl --http2 -I https://nghttp2.org
  2. HTTP/2 200
  3. date: Mon, 15 Apr 2019 12:53:49 GMT
  4. content-type: text/html
  5. last-modified: Fri, 08 Mar 2019 12:33:02 GMT
  6. etag: "5c8260fe-19d8"
  7. accept-ranges: bytes
  8. content-length: 6616
  9. x-backend-header-rtt: 0.011655
  10. strict-transport-security: max-age=31536000
  11. server: nghttpx
  12. via: 2 nghttpx
  13. x-frame-options: SAMEORIGIN
  14. x-xss-protection: 1; mode=block
  15. 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

  1. [cityfan]
  2. name=cityfan
  3. baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
  4. enabled=1
  5. gpgcheck=0

更新curl

yum update curl

作者:brookin

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号