3 ms·
> What I am a bit unsure about is actually how things like "transfer-encoding: chunked" or the various "connection" headers are supposed to be handled in server
by cryptonector 8y ago
> What I am a bit unsure about is actually how things like "transfer-encoding: chunked" or the various "connection" headers are supposed to be handled in servers/clients/libraries that are supposed to handle HTTP/1.1 and HTTP/2. Is this supposed to be automatically set on the lower level, depending on the actual protocol type. And the application level HTTP client or handler on server just sees the body as a stream? I'm not sure if that happens currently in common libraries, or whether they would forward these things if a client is connected via HTTP/1.1 and not when it's connected via HTTP/2.
Section 8.1.2.2 of RFC 7540 [0] covers most of what you ask except that it doesn't explain how chunked transfer-encoding maps to HTTP/2, and section 8.1.3 [1] shows an example of mapping chunked transfer-encoding onto HTTP/2 data frames.
Basically, in HTTP/2 all transfers are necessarily "chunked" into DATA frames [2] (necessarily because of multiplexing of channels!), and Content-Length -when present- merely indicates what all the chunks must add up to.
[0] https://tools.ietf.org/html/rfc7540#section-8.1.2.2
[1] https://tools.ietf.org/html/rfc7540#section-8.1.3
[2] https://tools.ietf.org/html/rfc7540#section-6.1
- Matthias247 8y agoI am aware how bodies are streamed in HTTP/2 (I have written an implementation). What I am not sure about is how libraries on client and server side are expected to handle this kind of information. A Lot of servers and client libraries might display "transfer-encoding: chunked" to their user, even though that wouldn't be seen if the connection was established via HTTP/2. It's more of a question of "how to hide those protocol differences from the user while still allowing them to set and access all information if required". And the question whether the HTTP ecosystem already embraces that, or whether most libraries still expose all the HTTP/1.1-only ways to the user.