[4.1] acc91cc Make req reachable from the pipe code
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Fri Aug 12 15:50:11 CEST 2016
commit acc91cc646e16f16c9b336afb0268a76d99a47a3
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Mon Jul 4 17:17:16 2016 +0100
Make req reachable from the pipe code
We will need it if the body was consumed due to a call to
std.cache_req_body (VRB_Cache).
Analysis and test by daghf.
Fixes #1881.
Conflicts:
bin/varnishd/cache/cache_req_fsm.c
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 6c5f95c..1b28b3b 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -591,6 +591,9 @@ cnt_pipe(struct worker *wrk, struct req *req)
if (wrk->handling == VCL_RET_SYNTH)
INCOMPL();
assert(wrk->handling == VCL_RET_PIPE);
+ AZ(bo->req);
+ bo->req = req;
+ bo->wrk = wrk;
if (VDI_Http1Pipe(req, bo) < 0)
VSLb(bo->vsl, SLT_VCL_Error, "Backend does not support pipe");
diff --git a/bin/varnishtest/tests/r01881.vtc b/bin/varnishtest/tests/r01881.vtc
new file mode 100644
index 0000000..5c3ab4d
--- /dev/null
+++ b/bin/varnishtest/tests/r01881.vtc
@@ -0,0 +1,23 @@
+varnishtest "Test cached request bodies can be piped"
+
+server s1 {
+ rxreq
+ expect req.bodylen == 6
+ expect req.http.foo == "true"
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ import std;
+
+ sub vcl_recv {
+ set req.http.foo = std.cache_req_body(10KB);
+ return (pipe);
+ }
+} -start
+
+client c1 {
+ txreq -body "foobar"
+ rxresp
+ expect resp.status == 200
+} -run
More information about the varnish-commit
mailing list