From: Olivier Houchard Date: Tue, 17 Nov 2026 14:38:01 +0000 (+0100) Subject: REGTESTS: decompression: test a large decompressed Content-Length response X-Git-Tag: v3.5-dev13~30 X-Git-Url: https://git.kaiwu.me/web//%22?a=commitdiff_plain;h=68a8abcbe31887c8efb6fcd4c64b7b6feaff1b51;p=haproxy.git REGTESTS: decompression: test a large decompressed Content-Length response This test sends a small gzip-compressed body with a Content-Length header, decompressing into more than a buffer, and checks that the whole decompressed body is received. It is used to validate the previous fix. --- diff --git a/reg-tests/decompression/http_large_cl.vtc b/reg-tests/decompression/http_large_cl.vtc new file mode 100644 index 000000000..44814f475 --- /dev/null +++ b/reg-tests/decompression/http_large_cl.vtc @@ -0,0 +1,41 @@ +varnishtest "HTTP decompression of a Content-Length response growing beyond a buffer" + +feature cmd "$HAPROXY_PROGRAM -cc 'feature(SLZ)'" +feature cmd "command -v gzip" + +feature ignore_unknown_macro + +# The whole compressed body is received at once and carries the end of the +# message, but it decompresses into more than a buffer. The end of message +# must only be reported once all the decompressed data were emitted. +shell { + yes "decompressed by haproxy" | head -c 24000 | gzip -c > ${tmpdir}/big.gz +} + +server s1 { + rxreq + txresp -hdr "Content-Encoding: gzip" -bodyfrom ${tmpdir}/big.gz +} -start + +haproxy h1 -conf { + defaults + mode http + timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" + timeout client "${HAPROXY_TEST_TIMEOUT-5s}" + timeout server "${HAPROXY_TEST_TIMEOUT-5s}" + + listen res + bind "fd@${res}" + decompression algo-res gzip + decompression mode-res always + filter decomp-res + server s1 ${s1_addr}:${s1_port} +} -start + +client c1 -connect ${h1_res_sock} { + txreq -url "/" + rxresp + expect resp.status == 200 + expect resp.http.content-encoding == "" + expect resp.bodylen == 24000 +} -run