]> git.kaiwu.me - haproxy.git/commit
REGTESTS: cache: cover the object lifetime with a single script
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 12 Nov 2026 15:39:34 +0000 (16:39 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 12 Nov 2026 17:20:32 +0000 (18:20 +0100)
commit7bd09e9060e5b4e519dd7fb545670d864171e40f
treed7873521306b77f2ea656e9d02a7989703183e9a
parentae2150c57f00757dad10eb863d8dba49c1218816
REGTESTS: cache: cover the object lifetime with a single script

The fixes about the object lifetime have no dedicated script each: the
reg-test reg-tests/cache/lifetime.vtc covers the whole lifetime
computation:

  - the lifetime comes from s-maxage, max-age, Expires, or falls back to
    the cache's max-age when the response has a validator (heuristic
    lifetime);
  - a null lifetime, written as "max-age=0", "max-age=00", a quoted
    "max-age=\"0\"" or a null s-maxage, prevents the response from being
    served from the cache;
  - the Age received from the server reduces a relative lifetime but not
    an absolute one given by Expires;
  - "Age: 0" is a valid value, it does not prevent the response from being
    cached;
  - the Age of a copy delivered by the cache stays below the lifetime
    announced by the server;
  - the Age header of a stored response is still forwarded to the client
    the response is delivered to, and the copies carry a single, freshly
    computed Age header.

All the checks are made from the response headers, without any delay: the
X-Age-Relative header is set by an http-after-response rule on the
responses delivered from the cache whose Age reaches the max-age
announced by the server, which can only happen when the entry lifetime
was not reduced by the Age. X-Age-Count reports the number of Age headers
to check the forwarded response and the copies.

The script fails when any of the covered fixes is reverted, and it runs
in a few milliseconds.
reg-tests/cache/lifetime.vtc [new file with mode: 0644]