From: Olivier Houchard Date: Wed, 2 Dec 2026 14:30:38 +0000 (+0100) Subject: BUG/MINOR: flt-decomp: don't lose emitted data on a truncated payload X-Git-Tag: v3.5.0~6 X-Git-Url: https://git.kaiwu.me/web/ngx_http_auth_basic_module.html?a=commitdiff_plain;h=91a4be224275006f3497af9627cf8ab605ec4da9;p=haproxy.git BUG/MINOR: flt-decomp: don't lose emitted data on a truncated payload When a truncated payload was detected, the error was reported immediately, and the decompressed data emitted during the same call were lost with it: for a 30kB response missing the end of its gzip stream, only 15.8kB were delivered before the abort. Now the error is only reported when nothing was emitted during the call and the channel has no more outgoing data. Until then, the filter waits to be called again once the output is drained. The filter was introduced in 3.5-dev6, so no backport is needed. --- diff --git a/src/flt_decomp.c b/src/flt_decomp.c index 46c6099f9..7cbeca256 100644 --- a/src/flt_decomp.c +++ b/src/flt_decomp.c @@ -446,10 +446,16 @@ static int decomp_stream_blk(struct stream *s, struct filter *f, struct channel * truncated. Nothing more will come, so it is an * error. Otherwise, the end of the message would be * held forever. + * + * But the error is only reported once all forwarded + * data were sent, because they would be lost + * otherwise. Until then, we wait to be called again + * when the output is drained. */ if (!blk && ((st->flags & DECOMP_STATE_EOM_SEEN) || htx_msg_ended(htx)) && !st->decomp_ctx->drain_len && - !(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE)) + !(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE) && + !total && !co_data(chn)) goto error; ret = decomp_stream_blk_drain(s, f, chn, NULL, NULL, 0);