From: Aurelien DARRAGON Date: Tue, 11 Aug 2026 14:41:26 +0000 (+0200) Subject: REG-TESTS: decompression: add basic decompression test X-Git-Tag: v3.5-dev6~48 X-Git-Url: https://git.kaiwu.me/$%7BGITURL%7D/doc/static/gitweb.js?a=commitdiff_plain;h=2659553104dda6b8b34090a1497f55478813bf52;p=haproxy.git REG-TESTS: decompression: add basic decompression test For now only basic HTTP decompression with a small payload is tested, because TCP decompression is not trivial to test with VTEST, and a HTTP decompression test with a big payload may eventually come later, provided it is not too slow. However, both request and response gzip decompression is tested. Other compression methods are not tested because it is not the intend of this test to check the decompression library itself, only haproxy behavior. --- diff --git a/reg-tests/decompression/basic.vtc b/reg-tests/decompression/basic.vtc new file mode 100644 index 000000000..c9381c224 --- /dev/null +++ b/reg-tests/decompression/basic.vtc @@ -0,0 +1,52 @@ +varnishtest "Basic decompression test" + +feature cmd "$HAPROXY_PROGRAM -cc 'feature(SLZ)'" + +feature ignore_unknown_macro + +server s1 { + # client c1 - request 1 + rxreq + expect req.url == "/c1" + expect req.http.content-encoding == "" + expect req.body == "haproxy request" + txresp \ + -hdr "Content-Encoding: gzip" \ + -gzipbody "haproxy response" +} -start + + +haproxy h1 -conf { + global + .if feature(THREAD) + thread-groups 1 + .endif + + defaults + mode http + timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" + timeout client "${HAPROXY_TEST_TIMEOUT-5s}" + timeout server "${HAPROXY_TEST_TIMEOUT-5s}" + + listen decomp-http + mode http + bind "fd@${decomp_http}" + decompression algo-req gzip + decompression mode-req always + decompression algo-res gzip + decompression mode-res always + + filter decomp-req + filter decomp-res + server s1 ${s1_addr}:${s1_port} +} -start + +client c1 -connect ${h1_decomp_http_sock} { + # 1. send compressed http and go through both request and response decompression on the proxy + txreq -url "/c1" \ + -hdr "User-Agent: Mozilla/4" \ + -gzipbody "haproxy request" + rxresp + expect resp.status == 200 + expect resp.body == "haproxy response" +} -run