[master] f93860a make VRT_handling a no-op if no ctx->handling pointer

Nils Goroll nils.goroll at uplex.de
Wed May 30 19:48:07 UTC 2018


commit f93860ab17ae239391f7d8e7a5f07c27249d0ab7
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 015c412..adeb349 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -376,6 +376,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 9af2346..8e8f169 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -179,7 +179,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