Remove chunked encoding on h1 -> h2 response transformation
Scope
HTTP/2 uses DATA frames to carry message payloads. The chunked transfer encoding defined in Section 4.1 of [RFC7230] MUST NOT be used in HTTP/2.
A response in chunked encoding must drop the chunked encoding: remove Transfer-Encoding: chunked header, remove chunks descriptors, move chunked trailer headers part to separate HEADERS frame.
Depending on message buffering (#498), a message can be entirely buffered or streamed by parts. For fully buffered messages it's OK to merge trailer headers with main headers and avoid adding extra HEADERS frame after DATA one. It reduces some work for us.
From Examples:
HTTP/1.1 200 OK HEADERS
Content-Type: image/jpeg ==> - END_STREAM
Transfer-Encoding: chunked + END_HEADERS
Trailer: Foo :status = 200
content-length = 123
123 content-type = image/jpeg
{binary data} trailer = Foo
0
Foo: bar DATA
- END_STREAM
{binary data}
HEADERS
+ END_STREAM
+ END_HEADERS
foo = bar
Testing
Send a response with chunked payload from a backend and forward it to h2 client. Client must receive message without chunked encoding. Also test case with chunked headers part.
The draft pull request https://github.com/tempesta-tech/tempesta/pull/1418 , tests https://github.com/tempesta-tech/tempesta-test/pull/164
@const-t hit the issue on fastcgi+php, i.e. installations like WordPress, so the bug is crucial