[6.0] 2f883b152 fix VRT_priv_task for calls from vcl_pipe {} and test for it

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Wed Nov 7 10:04:05 UTC 2018


commit 2f883b15279818abaafda32d122f98a8f64df6d3
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Nov 5 12:46:38 2018 +0100

    fix VRT_priv_task for calls from vcl_pipe {} and test for it
    
    Fixes #2820
    
    Conflicts:
            bin/varnishtest/tests/v00041.vtc

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index e4dd16479..52fd156b7 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -35,6 +35,7 @@
 #include <stdlib.h>
 
 #include "cache_varnishd.h"
+#include "vcl.h"
 
 struct vrt_priv {
 	unsigned			magic;
@@ -125,7 +126,9 @@ VRT_priv_task(VRT_CTX, const void *vmod_id)
 	struct vmod_priv *vp;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	assert(ctx->req == NULL || ctx->bo == NULL);
+	assert(ctx->req == NULL || ctx->bo == NULL ||
+	    ctx->method == VCL_MET_PIPE);
+
 	if (ctx->req) {
 		CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
 		id = (uintptr_t)ctx->req;
diff --git a/bin/varnishtest/tests/v00041.vtc b/bin/varnishtest/tests/v00041.vtc
index a67928ca9..3f86c9268 100644
--- a/bin/varnishtest/tests/v00041.vtc
+++ b/bin/varnishtest/tests/v00041.vtc
@@ -6,6 +6,11 @@ server s1 {
 	rxreq
 	txresp
 
+	rxreq
+	txresp
+	expect_close
+	accept
+
 	rxreq
 	txresp
 } -start
@@ -26,6 +31,18 @@ varnish v1 -arg "-p debug=+vclrel" -vcl+backend {
 	}
 
 	sub vcl_recv {
+		if (req.url == "/perf") {
+			return (synth(200));
+		}
+		if (req.url == "/pipe") {
+			return (pipe);
+		}
+		debug.test_priv_task(req.url);
+		set req.http.x0 = debug.test_priv_task();
+		debug.test_priv_task("bazz");
+	}
+
+	sub vcl_pipe {
 		debug.test_priv_task(req.url);
 		set req.http.x0 = debug.test_priv_task();
 		debug.test_priv_task("bazz");
@@ -109,6 +126,12 @@ client c1 {
 	expect resp.http.bx0 == "b /snafu"
 	expect resp.http.bx1 == "b /snafu"
 	expect resp.http.bo1 == "b /snafu"
+
+	txreq -url /perf
+	rxresp
+
+	txreq -url /pipe
+	rxresp
 } -run
 
 shell "echo 'vcl 4.0; backend foo { .host = \"${s1_addr}\"; .port = \"${s1_port}\"; }' > ${tmpdir}/_b00014.vcl"
diff --git a/doc/changes.rst b/doc/changes.rst
index faeaaaa84..5f8d3b90c 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -91,6 +91,8 @@ Varnish Cache 6.0.2 (unreleased)
 
 * Only dlclose() Vmods after all "fini" processing (2800_)
 
+* Fix VRT_priv_task for calls from vcl_pipe {} and test for it (2820_)
+
 .. _2418: https://github.com/varnishcache/varnish-cache/issues/2418
 .. _2589: https://github.com/varnishcache/varnish-cache/issues/2589
 .. _2654: https://github.com/varnishcache/varnish-cache/issues/2654
@@ -119,6 +121,7 @@ Varnish Cache 6.0.2 (unreleased)
 .. _2792: https://github.com/varnishcache/varnish-cache/pull/2792
 .. _2794: https://github.com/varnishcache/varnish-cache/issues/2794
 .. _2800: https://github.com/varnishcache/varnish-cache/issues/2800
+.. _2820: https://github.com/varnishcache/varnish-cache/issues/2820
 
 
 ================================


More information about the varnish-commit mailing list