mirror of
https://github.com/xroche/httrack.git
synced 2026-06-28 13:07:35 +03:00
The -#A cache self-test writes the cache with the same build it reads back, a round-trip that by construction cannot catch a read-path or on-disk-ZIP format regression: a writer and reader that drift together still agree. The batch-6 read-path bounds work (ZIP_READFIELD_STRING, the r.adr/r.location NUL invariant) had no guard against exactly that. Add a hidden -#B subcommand that reads a committed, frozen new.zip (tests/fixtures/cache-golden) and asserts a fixed set of entries -- normal HTML, an empty redirect with a Location, JSON, a binary body with embedded NUL and high bytes plus a Content-Disposition, a 404 -- still decodes field for field and byte for byte. The fixture is a witness written once by an earlier build; the table in htscache_selftest.c that defines the expectations also regenerates it via `-#B <dir> regen`, used only when the format changes on purpose. Every body stays in the ZIP (all_in_cache=1), so reading needs only new.zip with no on-disk body, timestamp, or path dependency -- portable across machines and through make distcheck's read-only srcdir. check_entry now also asserts Content-Disposition (cdispo) and tags its diagnostics with the running mode (cache-selftest vs cache-golden). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>