作者:victor | 来源:互联网 | 2023-05-20 15:55
现在我curl -I
用来检索标题.
在即将采用的浏览器采用HTTP/2时,网站会采用不同的方式为HPACK提供标头,这会使我对curl命令的使用无效吗?
1> p4guru..:
我相信这取决于卷曲版本.在curl 7.36.x IIRC中添加了HTTP/2?并非所有的发行版都有这个版本?
这是针对https://google.com的 HTTP/2卷曲7.41.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | curl --http2 -I - v https: //google .com
* Rebuilt URL to: https: //google .com/
* Trying 173.194.123.1...
* Connected to google.com (173.194.123.1) port 443 (
* ALPN, offering h2-14, http /1 .1
* ALPN, server accepted to use h2-14
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=*.google.com
* start date : 2015-03-11 16:13:43 GMT
* expire date : 2015-06-09 00:00:00 GMT
* subjectAltName: google.com matched
* issuer: C=US; O=Google Inc; CN=Google Internet Authority G2
* SSL certificate verify ok.
* Using HTTP2
|
编辑:更正,卷曲--http2需要编译为nghttp2工作https://nghttp2.org/
1 2 3 4 | curl --version
curl 7.41.0 (x86_64-unknown-linux-gnu) libcurl /7 .41.0 OpenSSL /1 .0.2b zlib /1 .2.8 nghttp2 /0 .7.8-DEV
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets
|