When a compressed response has neither a content-length nor a chunked
encoding, its end is only known when the server closes. In this case,
http_response_forward_body() ends the message as soon as the close is
reported and the filter is not called anymore, so the decompressed data
it could not emit yet were lost. The response was silently truncated,
e.g. 998006 bytes delivered out of 1MB, with nothing reported to the
client nor in the logs.
Let's not decompress such messages, like the compression filter already
does. They are forwarded untouched, with their content-encoding header,
including in "always" mode. The filter was introduced in 3.5-dev6, so no
backport is needed.
if (msg->flags & HTTP_MSGF_BODYLESS)
goto no_decomp;
+ /* the end of the payload is unknown without a transfer length */
+ if (!(msg->flags & HTTP_MSGF_XFER_LEN))
+ goto no_decomp;
+
if (msg->chn->flags & CF_ISRESP) {
struct http_txn *txn = s->txn.http;