[5.1] 3f4a5a1 Don't panic if return(pass(DURATION)) is used on client side. Ignore the argument with a VSL message.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Apr 10 13:59:08 CEST 2017
commit 3f4a5a1bc3f7ce22136f161149854e483d3478b6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Apr 3 06:33:22 2017 +0000
Don't panic if return(pass(DURATION)) is used on client side. Ignore
the argument with a VSL message.
Fixes: #2299
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index efc877f..a8100b3 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -91,6 +91,11 @@ VRT_hit_for_pass(VRT_CTX, VCL_DURATION d)
struct objcore *oc;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+ if (ctx->bo == NULL) {
+ VSLb(ctx->vsl, SLT_Error,
+ "Note: Ignoring DURATION argument to return(pass);");
+ return;
+ }
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
oc = ctx->bo->fetch_objcore;
oc->ttl = d;
diff --git a/bin/varnishtest/tests/c00010.vtc b/bin/varnishtest/tests/c00010.vtc
index 5e8b087..a128b73 100644
--- a/bin/varnishtest/tests/c00010.vtc
+++ b/bin/varnishtest/tests/c00010.vtc
@@ -17,7 +17,7 @@ varnish v1 -vcl+backend {
if (req.url == "/foo") {
return(hash);
} else {
- return(pass);
+ return(pass(10m));
}
}
sub vcl_hit {
More information about the varnish-commit
mailing list