Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure Age is always less than max-age
By rounding Age down, we make sure Age < max-age while the object is fresh. Otherwise, we can prematurely get Age == max-age and Varnish will calculate that as a 0s TTL and create a pass scenario. Conflicts: bin/varnishd/cache/cache_req_fsm.c
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
varnishtest "Check that Age is always less than max-age while not stale" | ||
|
||
server s1 { | ||
rxreq | ||
expect req.url == "/" | ||
txresp -hdr "Cache-control: max-age=2" | ||
} -start | ||
|
||
varnish v1 -vcl+backend { } -start | ||
|
||
client c1 { | ||
txreq -url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.Age == 0 | ||
|
||
delay 0.8 | ||
|
||
txreq -url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.Age == 0 | ||
|
||
delay 1.0 | ||
|
||
txreq -url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.Age == 1 | ||
} -run |