]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: flt-decomp: preserve pending output before decoding again
authorTiburce GIROUX <tgiroux@haproxy.com>
Mon, 9 Nov 2026 18:13:37 +0000 (19:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Nov 2026 07:36:38 +0000 (08:36 +0100)
The HTTP no-input path tries to drain the decompressor's pending output,
then may call add_data() with an empty input even when the drain was only
partial. decomp_uslz_add_data() replaces drain and drain_len with the new
result, so this can discard output that has not yet been forwarded.

Only call the decoder again after the previous output has been fully
drained, as the TCP decompression path already does.

src/flt_decomp.c

index 670095845d9f797daff0adf14501af85badddfcc..8c1823439e9eefd78c4e4d49e8859f34a153926d 100644 (file)
@@ -382,7 +382,8 @@ static int decomp_stream_blk(struct stream *s, struct filter *f, struct channel
                ret = decomp_stream_blk_drain(s, f, chn, NULL, NULL, 0);
                total += ret;
 
-               if (!(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE)) {
+               if (!st->decomp_ctx->drain_len &&
+                   !(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE)) {
                        char *data = "";
 
                        /* ensure there isn't remaining data in the decomp state buffer: