tempesta icon indicating copy to clipboard operation
tempesta copied to clipboard

Chunked transfer encoding: cached response is truncated

Open b3b opened this issue 3 years ago • 1 comments

Scope

Cached response is truncated (missing the final CRLF) when chunked transfer encoding is used by backend. This causes client to hang waiting for an incomplete response.

Related issue: #1692

Example

Original response from the WordPress (https://github.com/tempesta-tech/tempesta-test/issues/290) :

142b0\r\n
<!DOCTYPE html>
...
</html>
\r\n
0\r\n
\r\n

and cached response:

142b0\r\n
<!DOCTYPE html>
...
</html>
\r\n
0\r\n

Testing

Test to reproduce:: cache.test_cache.TestChunkedResponse

b3b avatar Sep 20 '22 13:09 b3b

Now we use another cache strategy. Before placing response into cache, tempesta transform response to regular form, without chunks and adds Content-Length header. It means once "expected chunked" response will be retrieved from the cache it must not contain any chunking information and must contain Content-Length header.

const-t avatar Sep 29 '22 14:09 const-t

FIxed by PR #1418

const-t avatar Nov 08 '22 14:11 const-t