During the compression, on a DATA block, the next blocks was tested to know
if the end of data was reached. However, it is not valid to do so because a
prior filter may have limited the data forwarding to the current block to
inject more DATA blocks later for instance. Because of this bug, we could
detect the end of the payload too early, hijacking this way processing of
prior filters.
This test was added as an optimization, to save a loop on the HTX
message. So it can be safely removed.
For now, it is not possible to hit the bug with in-house filters. But a lua
filter modifiying the payload could trigger it. And it will be an issue if
the compression filter is chained with the decompression one (once
added). So let's fix it now.
This patch must be backported to all supported versions.
msg->chn->flags |= CF_WAKE_WRITE;
goto end;
}
-
switch (type) {
case HTX_BLK_DATA:
/* it is the last data block */
- last = ((!next && (htx->flags & HTX_FL_EOM)) || (next && htx_get_blk_type(next) != HTX_BLK_DATA));
+ last = (!next && (htx->flags & HTX_FL_EOM));
v = htx_get_blk_value(htx, blk);
v = istadv(v, offset);
if (v.len > len) {