[6.0] 911d2b8c9 Use req->ws for the ctx when piping
Reza Naghibi
reza at naghibi.com
Wed Aug 19 13:17:08 UTC 2020
commit 911d2b8c999b1f1a637aeea71410006cecf8771e
Author: Reza Naghibi <reza at naghibi.com>
Date: Fri Aug 14 10:01:02 2020 -0400
Use req->ws for the ctx when piping
Fixes #3329
Fixes #3385
diff --git a/bin/varnishd/cache/cache_vcl_vrt.c b/bin/varnishd/cache/cache_vcl_vrt.c
index a63161b81..4133f46b7 100644
--- a/bin/varnishd/cache/cache_vcl_vrt.c
+++ b/bin/varnishd/cache/cache_vcl_vrt.c
@@ -353,11 +353,13 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
VCL_Req2Ctx(&ctx, req);
}
if (bo != NULL) {
- if (req)
- assert(method == VCL_MET_PIPE);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->vcl, VCL_MAGIC);
VCL_Bo2Ctx(&ctx, bo);
+ if (req) {
+ assert(method == VCL_MET_PIPE);
+ ctx.ws = req->ws;
+ }
}
assert(ctx.now != 0);
ctx.syntax = ctx.vcl->conf->syntax;
diff --git a/bin/varnishtest/tests/r03329.vtc b/bin/varnishtest/tests/r03329.vtc
new file mode 100644
index 000000000..f3453bb61
--- /dev/null
+++ b/bin/varnishtest/tests/r03329.vtc
@@ -0,0 +1,18 @@
+varnishtest "Lost reason from pipe to synth"
+
+server s1 {} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ return (pipe);
+ }
+ sub vcl_pipe {
+ return (synth(505, req.http.foo + "/bar"));
+ }
+} -start
+
+client c1 {
+ txreq -hdr "foo: foo"
+ rxresp
+ expect resp.reason == "foo/bar"
+} -run
diff --git a/bin/varnishtest/tests/r03385.vtc b/bin/varnishtest/tests/r03385.vtc
new file mode 100644
index 000000000..cee34301f
--- /dev/null
+++ b/bin/varnishtest/tests/r03385.vtc
@@ -0,0 +1,23 @@
+varnishtest "Use a priv in vcl_pipe"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ import debug;
+
+ sub vcl_recv {
+ return (pipe);
+ }
+
+ sub vcl_pipe {
+ debug.test_priv_task();
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+} -run
More information about the varnish-commit
mailing list