Commit 1dc303aa authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

The vcl_purge{} method can return synth or restart.

(Remember to change the "PURGE" to "GET" if you do this.)

Fixes #1493
parent 36c5d3a7
......@@ -830,7 +830,16 @@ cnt_purge(struct worker *wrk, struct req *req)
AZ(HSH_DerefObjCore(&wrk->stats, &boc));
VCL_purge_method(req->vcl, wrk, req, NULL, req->http->ws);
req->req_step = R_STP_SYNTH;
switch (wrk->handling) {
case VCL_RET_RESTART:
req->req_step = R_STP_RESTART;
break;
case VCL_RET_SYNTH:
req->req_step = R_STP_SYNTH;
break;
default:
WRONG("Illegal return from vcl_purge{}");
}
return (REQ_FSM_MORE);
}
......
varnishtest "restart in vcl_purge"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.method == "PURGE") {
return (purge);
}
}
sub vcl_purge {
set req.method = "GET";
return (restart);
}
} -start
client c1 {
txreq -req PURGE
rxresp
expect resp.status == 200
} -run
......@@ -100,7 +100,7 @@ returns =(
),
('purge',
"C",
('synth', 'fetch',)
('synth', 'restart',)
),
('miss',
"C",
......
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