-1

HTTP/2 has several differences with respect to HTTP/1.1. One of them is the use of frames, binary numbers and compression to optimize the headers. However, when I use "curl -v --http2" against a domain that supports HTTP/2, I can see response headers like "Server" or "Cache-control". Even if I use the "curl -v --http2-prior-knowledge" option against a domain that supports HTTP/2, I can see the "TLS Handshake" and HTTP headers like "date", "server, "cache-control", "pragma", etc. My question is: If HTTP/2 uses frames, binary and compression, why can I see headers? Shouldn't they be "invisible"?

john smith
  • 41
  • 2
  • Invisible? Why it should be? the http standard make use of these frame, to know what server you want to visit and the date allow for the caching. – yagmoth555 Sep 12 '19 at 15:13
  • I thought that, due to the use of binary numbers, curl was not able to interpret the headers. I guess I'm wrong in my assumption, aren't I? – john smith Sep 12 '19 at 15:33
  • 1
    curl is the client. I should hope it can interpret the headers it's working with! –  Sep 12 '19 at 16:25
  • Shouldn't they appear in binary format? Curl translates them into plain text? – john smith Sep 12 '19 at 16:37
  • 2
    That's what a client does. After all, plain text is transmitted over the Internet in binary, too, and needs to be translated into a human readable form. – Esa Jokinen Sep 12 '19 at 17:19
  • A client's job is to use some protocol to get data from a server, decode them and display them in an useful manner. Would you like a web browser to show you raw binary data instead of rendered web pages? – Massimo Sep 13 '19 at 07:34

1 Answers1

1

curl is a fully fledged http/2 client (when you use the right switches) and when you would do a packet capture the individual network packets would only contain binary data and not ASCII headers.

Since returning binary data to an operator is mostly quite senseless curl will both decode the TLS and binary components of the underlying network protocols and try to send human readable headers to the console

HBruijn
  • 72,524
  • 21
  • 127
  • 192