[master] c41ab01 Move req->ws_req snapshotting until after VFP_Setup
Dag Haavi Finstad
daghf at varnish-software.com
Tue Aug 15 11:00:10 CEST 2017
commit c41ab01506053bf6844a895e9c66219f88460fc6
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Mon Aug 14 16:02:41 2017 +0200
Move req->ws_req snapshotting until after VFP_Setup
This lets the request's vfp stack survive a VCL label change.
Fixes: #2367
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index bd3e4af..2697b4c 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -81,7 +81,6 @@ cnt_transport(struct worker *wrk, struct req *req)
wrk->stats->client_req++;
AZ(req->err_code);
- req->ws_req = WS_Snapshot(req->ws);
req->doclose = http_DoConnection(req->http);
if (req->doclose == SC_RX_BAD) {
@@ -97,6 +96,7 @@ cnt_transport(struct worker *wrk, struct req *req)
req->transport->req_body(req);
}
+ req->ws_req = WS_Snapshot(req->ws);
HTTP_Copy(req->http0, req->http); // For ESI & restart
req->req_step = R_STP_RECV;
return (REQ_FSM_MORE);
diff --git a/bin/varnishtest/tests/r02367.vtc b/bin/varnishtest/tests/r02367.vtc
new file mode 100644
index 0000000..3ae0cb9
--- /dev/null
+++ b/bin/varnishtest/tests/r02367.vtc
@@ -0,0 +1,22 @@
+varnishtest "POST and return(vcl(..))"
+
+server s1 {
+ rxreq
+ expect req.bodylen == 4
+ txresp
+} -start
+
+varnish v1 -vcl+backend {} -start
+varnish v1 -cliok "vcl.label vclA vcl1"
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ return (vcl(vclA));
+ }
+}
+
+client c1 {
+ txreq -req POST -body "asdf"
+ rxresp
+ expect resp.status == 200
+} -run
More information about the varnish-commit
mailing list