Commit 2679bb6d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Allow return(abandon) in vcl_backend_error{}

Submitted by:	fgs
parent 6eb3f1eb
...@@ -800,14 +800,16 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) ...@@ -800,14 +800,16 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
AZ(VSB_finish(synth_body)); AZ(VSB_finish(synth_body));
if (wrk->handling == VCL_RET_RETRY) { if (wrk->handling == VCL_RET_RETRY ||
wrk->handling == VCL_RET_ABANDON) {
VSB_delete(synth_body); VSB_delete(synth_body);
bo->doclose = SC_RESP_CLOSE; bo->doclose = SC_RESP_CLOSE;
if (bo->director_state != DIR_S_NULL) if (bo->director_state != DIR_S_NULL)
VDI_Finish(bo->wrk, bo); VDI_Finish(bo->wrk, bo);
if (bo->retries++ < cache_param->max_retries) if (wrk->handling == VCL_RET_RETRY &&
bo->retries++ < cache_param->max_retries)
return (F_STP_RETRY); return (F_STP_RETRY);
return (F_STP_FAIL); return (F_STP_FAIL);
......
varnishtest "vcl_backend_fetch abandon" varnishtest "Test abandon from vcl_backend_xxx"
server s1 { server s1 {
rxreq rxreq
expect req.url == "/bar"
txresp txresp
} -start } -start
varnish v1 -vcl+backend { varnish v1 -arg "-pfirst_byte_timeout=0.1" -vcl+backend {
sub vcl_backend_fetch { sub vcl_backend_fetch {
if (bereq.url == "/foo") {
return (abandon);
}
}
sub vcl_backend_response {
if (bereq.url == "/bar") {
return (abandon);
}
}
sub vcl_backend_error {
return (abandon); return (abandon);
} }
} -start } -start
client c1 { client c1 {
txreq txreq -url /foo
rxresp
expect resp.status == 503
txreq -url /bar
rxresp
expect resp.status == 503
txreq -url /baz
rxresp rxresp
expect resp.status == 503 expect resp.status == 503
} -run } -run
...@@ -132,7 +132,7 @@ returns =( ...@@ -132,7 +132,7 @@ returns =(
), ),
('backend_error', ('backend_error',
"B", "B",
('deliver', 'retry') ('deliver', 'retry', 'abandon')
), ),
############################################################### ###############################################################
......
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