]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: shctx: fix shctx_row_data_get() when offset exceeds a block
authorMaxime Henrion <mhenrion@haproxy.com>
Wed, 8 Jul 2026 16:37:07 +0000 (12:37 -0400)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Jul 2026 14:42:35 +0000 (16:42 +0200)
commit6750c36adfc82bb4102a2c7a12b1caa20801c39f
treea960e5451cbf88b0c6069b91fb0d319cd5d6b63f
parentf34517a1aac4b753a25e982f9aaeb2e1d7e2eba9
BUG/MINOR: shctx: fix shctx_row_data_get() when offset exceeds a block

The loop advanced the block pointer only after the copy, but skipped
blocks preceding <offset> with a continue, which bypassed that advance.
As a result any read starting past the first block copied nothing.

This notably affects conditional requests: should_send_notmodified_response()
reads the stored ETag at entry->etag_offset, so a cached response whose
ETag header sits beyond the first block fails revalidation and is served
in full (200) instead of 304.

Rewrite the loop as a for() so the block pointer always advances,
regardless of whether the current block is copied or skipped.

This should be backported as far as 2.6.
src/shctx.c