httpcurlservinghttp2

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


Right now I use curl -I to retrieve headers.

Will sites adopt a different way of serving headers with HPACK in the upcoming adoption of HTTP/2 by browsers that will render my use of the curl command ineffective?


Solution

  • 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.