Unverified Commit 16e98e96 authored by Reza Naghibi's avatar Reza Naghibi Committed by Nils Goroll

Use req->ws in the ctx when piping

Previously bo->ws was used which led to workspace mixing. req->ws safely
outlives both the bo and req object when piping.
parent 7d6d1d85
......@@ -459,11 +459,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.specific = specific;
......
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
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment