BUG/MEDIUM: cache: use the correct time reference when comparing dates

The cache makes use of dates advertised by external components, such
as "last-modified" or "date". As such these are wall-clock dates, and
not internal dates. However, all comparisons are mistakenly made based
on the internal monotonic date which is designed to drift from the wall
clock one in order to catch up with stolen time (which can sometimes be
intense in VMs). As such after some run time some objects may fail to
validate or fail to expire depending on the direction of the drift. This
is particularly visible when applying an offset to the internal time to
force it to wrap soon after startup, as it will be shifted up to 49.7
days in the future depending on the current date; what happens in this
case is that the reg-test "cache_expires.vtc" fails on the 3rd test by
returning stale contents from the cache at the date of this commit.

It is really important that all external dates are compared against
"date" and not "now" for this reason.

This fix needs to be backported to all versions.

(cherry picked from commit 9b5d57dfd5047b167896e08128c029dc7d3615b8)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit c188486a2872a8fc6bd934b2fc1c421f068e18e0)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit eb039d10920a631a2946a9c1562c997b2a84700f)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit ee0e12c55fb2853055fda7eb0694a267f4549265)
Signed-off-by: Willy Tarreau <w@1wt.eu>
1 file changed