Skip to content

Commit

Permalink
Move req->ws_req snapshotting until after VFP_Setup
Browse files Browse the repository at this point in the history
This lets the request's vfp stack survive a VCL label change.

Fixes: #2367
  • Loading branch information
daghf committed Aug 15, 2017
1 parent 0aa0836 commit c41ab01
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/varnishd/cache/cache_req_fsm.c
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
22 changes: 22 additions & 0 deletions 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

0 comments on commit c41ab01

Please sign in to comment.