Commit 8100bdd2 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r4204: Prevent infinite restart recursion

it was possible to have infinite recursion between vcl_error returning
restart and cnt_recv calling vcl_error when you had too many restarts



git-svn-id: http://www.varnish-cache.org/svn/branches/2.0@4310 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 78f68a01
......@@ -349,13 +349,15 @@ cnt_error(struct sess *sp)
http_StatusMessage(sp->err_code));
VCL_error_method(sp);
if (sp->handling == VCL_RET_RESTART) {
if (sp->handling == VCL_RET_RESTART && sp->restarts < params->max_restarts) {
HSH_Drop(sp);
sp->director = NULL;
sp->restarts++;
sp->step = STP_RECV;
return (0);
}
} else if (sp->handling == VCL_RET_RESTART)
sp->handling = VCL_RET_DELIVER;
/* We always close when we take this path */
sp->doclose = "error";
......
# $Id$
test "Test that we can't recurse restarts forever"
varnish v1 -vcl {
backend bad {
.host = "127.0.0.1";
.port = "9090";
}
sub vcl_recv {
set req.backend = bad;
}
sub vcl_error {
restart;
}
} -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 503
} -run
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