[6.0] 1350a400c make VRT_handling a no-op if no ctx->handling pointer

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:05 UTC 2018


commit 1350a400cbad6ce377812dacf1a3424c42765f05
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed May 30 12:57:44 2018 +0200

    make VRT_handling a no-op if no ctx->handling pointer
    
    This is the case for the ctx created for director operations as first
    introduced with 5536f102b677e6b469f191fedab1c4cf51144e2c
    
    Alternatively, we could always set ctx->handling to some location
    with the same scope as the ctx, but as we are not inside VCL (and
    just happen to use the same context for simplicity and reusability
    of VRT/vmod functions), adding specific handling appears to be the
    cleaner solution.
    
    Fixes #2692

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 6001d323b..433ffd02f 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -377,6 +377,8 @@ VRT_handling(VRT_CTX, unsigned hand)
 {
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	if (ctx->handling == NULL)
+		return;
 	assert(hand > 0);
 	assert(hand < VCL_RET_MAX);
 	// XXX:NOTYET assert(*ctx->handling == 0);
diff --git a/include/vrt.h b/include/vrt.h
index 7939459b5..fdc454bba 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -177,7 +177,7 @@ struct vrt_ctx {
 
 	unsigned			syntax;
 	unsigned			method;
-	unsigned			*handling;
+	unsigned			*handling;	// not in director context
 	unsigned			vclver;
 
 	struct vsb			*msg;	// Only in ...init()


More information about the varnish-commit mailing list