[master] 7a13ff561 fix VRT_priv_task for calls from vcl_pipe {} and test for it
Nils Goroll
nils.goroll at uplex.de
Mon Nov 5 11:48:09 UTC 2018
commit 7a13ff561c43391c82f82dd90a250f2b9f88a3d3
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
diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 754605146..6b3b455fe 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;
@@ -127,7 +128,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 533f7d246..e6cfc3c8e 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
@@ -29,6 +34,15 @@ varnish v1 -arg "-p debug=+vclrel -p workspace_client=1m" -vcl+backend {
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");
@@ -125,6 +139,9 @@ client c1 {
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"
More information about the varnish-commit
mailing list