[master] 06f9176 A hash_always_miss can override a hit-for-pass
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Thu Mar 9 14:15:07 CET 2017
commit 06f9176f68c1dfd3318b52ecd68530d2ba9fc111
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Thu Mar 9 14:13:45 2017 +0100
A hash_always_miss can override a hit-for-pass
diff --git a/bin/varnishtest/tests/c00082.vtc b/bin/varnishtest/tests/c00082.vtc
new file mode 100644
index 0000000..6d0c27b
--- /dev/null
+++ b/bin/varnishtest/tests/c00082.vtc
@@ -0,0 +1,39 @@
+varnishtest "hash_always_miss overrides hit-for-pass"
+
+server s1 {
+ rxreq
+ txresp -hdr "Hit-Pass: forever"
+
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ set req.hash_always_miss = (req.http.Hash == "always-miss");
+ }
+
+ sub vcl_backend_response {
+ if (beresp.http.Hit-Pass == "forever") {
+ return (pass(1y));
+ }
+ }
+
+ sub vcl_deliver {
+ set resp.http.Obj-Hits = obj.hits;
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.http.Obj-Hits == 0
+
+ txreq -hdr "Hash: always-miss"
+ rxresp
+ expect resp.http.Obj-Hits == 0
+
+ txreq
+ rxresp
+ expect resp.http.Obj-Hits == 1
+} -run
More information about the varnish-commit
mailing list