Will I be able to use CURL to get HTTP/2 headers? Will I be able to use CURL to get HTTP/2 headers? curl curl

Will I be able to use CURL to get HTTP/2 headers?


Yes, you can use curl to see and send HTTP headers with HTTP/2 just as you do with HTTP/1.

curl supports HTTP/2 and it is implemented as a sort of translation layer. It means it shows and "pretends" that headers work 1.1 style. It shows headers as text and it sends headers in callbacks like they were done with 1.1. We made it this way to make scripts and applications get a very smooth and basically invisible transition path to HTTP/2 with curl.

Internally that is of course done by decompressing received headers before showing them, and showing them before compressing them when sending them.


I believe it depends on curl version. HTTP/2 was added in curl 7.36.x IIRC ? not all distros would have that version ?

This is with curl 7.41.0 over HTTP/2 against https://google.com

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 (#0)* 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    

edit: correction, curl --http2 needs nghttp2 compiled for it to work https://nghttp2.org/

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-DEVProtocols: 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