]> git.ipfire.org Git - thirdparty/haproxy.git/commit
IMPORT: slz/uslz: add a method to impose an envelope format (gzip or zlib)
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 11 Aug 2026 16:40:05 +0000 (18:40 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 12 Aug 2026 07:14:07 +0000 (09:14 +0200)
commit8e32ba6efadcf65ba5e01e5883146eaa005dbe8a
tree2e70a91c42823f45d9c1e1307dfa586c17ff430c
parent6bbb0124257bd54874e4ce1ad737c054d52f2deb
IMPORT: slz/uslz: add a method to impose an envelope format (gzip or zlib)

This is actually a way to refuse non-matching formats and not letting the
decoder auto-detect a format. This is done using uslz_init_fmt() with a
4th argument instead of uslz_init():

  - SLZ_FMT_DEFLATE skips detection entirely, since the first bits of the
    stream are already the first block header (deflate has no envelpoe).

  - SLZ_FMT_GZIP and SLZ_FMT_ZLIB parse their envelope as before, but the
    stream is now rejected with E_CORRUPT if it does not carry the
    announced one, instead of falling back to raw deflate and returning
    garbage. That might matter when the format comes from the outside, an
    HTTP Content- Encoding for instance, where accepting a different
    envelope is wrong (though would likely have to be accepted anyway).

The main purpose is in fact to use this in tests to validate specific
envelopes, something that is currently not possible (i.e. if zenc lies,
zdec silently adapts).

This is libslz upstream commit d2829de469741f0c664fcc3e29d6152ab6993ef4
include/import/slz.h
src/uslz.c