Commit 213a251e authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

A hash_always_miss can override a hit-for-pass

With a more assertive test this time.
parent 06f9176f
...@@ -2,9 +2,15 @@ varnishtest "hash_always_miss overrides hit-for-pass" ...@@ -2,9 +2,15 @@ varnishtest "hash_always_miss overrides hit-for-pass"
server s1 { server s1 {
rxreq rxreq
expect req.http.Uncacheable == false
txresp -hdr "Hit-Pass: forever" txresp -hdr "Hit-Pass: forever"
rxreq rxreq
expect req.http.Uncacheable == true
txresp
rxreq
expect req.http.Uncacheable == false
txresp txresp
} -start } -start
...@@ -13,6 +19,10 @@ varnish v1 -vcl+backend { ...@@ -13,6 +19,10 @@ varnish v1 -vcl+backend {
set req.hash_always_miss = (req.http.Hash == "always-miss"); set req.hash_always_miss = (req.http.Hash == "always-miss");
} }
sub vcl_backend_fetch {
set bereq.http.Uncacheable = bereq.uncacheable;
}
sub vcl_backend_response { sub vcl_backend_response {
if (beresp.http.Hit-Pass == "forever") { if (beresp.http.Hit-Pass == "forever") {
return (pass(1y)); return (pass(1y));
...@@ -24,11 +34,27 @@ varnish v1 -vcl+backend { ...@@ -24,11 +34,27 @@ varnish v1 -vcl+backend {
} }
} -start } -start
logexpect l1 -v v1 -g request {
expect * 1001 VCL_return lookup
expect * 1001 VCL_call MISS
expect * 1002 TTL "^HFP 31536000 "
expect * 1003 VCL_return lookup
expect * 1003 VCL_call PASS
expect * 1005 VCL_return lookup
expect * 1005 VCL_call MISS
expect * 1007 VCL_return lookup
expect * 1007 VCL_call HIT
} -start
client c1 { client c1 {
txreq txreq
rxresp rxresp
expect resp.http.Obj-Hits == 0 expect resp.http.Obj-Hits == 0
txreq
rxresp
expect resp.http.Obj-Hits == 0
txreq -hdr "Hash: always-miss" txreq -hdr "Hash: always-miss"
rxresp rxresp
expect resp.http.Obj-Hits == 0 expect resp.http.Obj-Hits == 0
...@@ -37,3 +63,5 @@ client c1 { ...@@ -37,3 +63,5 @@ client c1 {
rxresp rxresp
expect resp.http.Obj-Hits == 1 expect resp.http.Obj-Hits == 1
} -run } -run
logexpect l1 -wait
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment