3 ms·
Whats with those header fields that start with a colon: :authority:blog.cloudflare.com :method:GET :path:/assets/images/cloudflare-sprite-small.png :sc
by ape4 10y ago
Whats with those header fields that start with a colon:
:authority:blog.cloudflare.com
:method:GET
:path:/assets/images/cloudflare-sprite-small.png
:scheme:https
Isn't that going to confuse every header parser.
- pilif 10y agoThat's just a way to spell out the HTTP 2 request-line (its http/1 equivalent would be the very first line of the request like `GET / HTTP/1.0`) in human-readable form. No parser is ever going to parse these strings. HTTP2 supporting libraries see the well-known binary values and libraries without support for HTTP2 will fall-back to HTTP1 anyways where the human-readable form of the request-line is, well, just the request line itself.
- ape4 10y agoThanks, now I know.
- Matthias247 10y agoThey are called pseudo-headers. They are used to transfer the values of the traditional start line of requests and responses. As in HTTP/2 there is no such start line they are encoded like other headers, but are using the colon in front of the key to denote them as pseudo-headers. Each request must contain all the required pseudo headers (:method, :path, :scheme) - same for the response. And no - this doesn't confuse a header parser since they are not parsed with an HTTP/1 header parser but with the HTTP/2 header tranmission mechanism (HPACK - as shown in the article). Before handing the request to your traditional web app the HTTP/2 server would remove those values from the set of received header fields and instead put them into the request struct.