From: Christopher Faulet Date: Fri, 21 Dec 2018 14:10:25 +0000 (+0100) Subject: BUG/MINOR: compression/htx: Don't add the last block of data if it is empty X-Git-Tag: v2.0-dev0~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d238ae3a9b82b32bf7ca859555faf974f55042fa;p=thirdparty%2Fhaproxy.git BUG/MINOR: compression/htx: Don't add the last block of data if it is empty In HTX, when the compression filter analyze the EOM, it flushes the compression context and add the last block of compressed data. But, this block can be empty. In this case, we must ignore it. --- diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index ce0dba17c0..380366b066 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -255,10 +255,12 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg, } if (htx_compression_buffer_end(st, &trash, 1) < 0) goto error; - blk = htx_add_data_before(htx, blk, ist2(b_head(&trash), b_data(&trash))); - if (!blk) - goto error; - to_forward += b_data(&trash); + if (b_data(&trash)) { + blk = htx_add_data_before(htx, blk, ist2(b_head(&trash), b_data(&trash))); + if (!blk) + goto error; + to_forward += b_data(&trash); + } msg->flags &= ~HTTP_MSGF_COMPRESSING; /* We let the mux add last empty chunk and empty trailers */ }