Commit 3ecacd9d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

If there is a backend or director named "default", make that the default,

otherwise use the first backend or director we find as default.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4982 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 0252cae9
......@@ -725,15 +725,9 @@ vcc_ParseDirector(struct tokenlist *tl)
return;
}
if (isfirst == 1) {
/*
* If this is the first backend|director explicitly
* defined, use it as default backend.
*/
Fi(tl, 0,
"\tVCL_conf.director[0] = VCL_conf.director[%d];\n",
tl->ndirector - 1);
vcc_AddRef(tl, tl->t_dir, R_BACKEND);
if (isfirst == 1 || vcc_IdIs(tl->t_dir, "default")) {
tl->defaultdir = tl->ndirector - 1;
tl->t_defaultdir = tl->t_dir;
}
tl->t_policy = NULL;
......
......@@ -589,6 +589,11 @@ vcc_CompileSource(struct vsb *sb, struct source *sp)
return (vcc_DestroyTokenList(tl, NULL));
}
/* Configure the default director */
Fi(tl, 0, "\tVCL_conf.director[0] = VCL_conf.director[%d];\n",
tl->defaultdir);
vcc_AddRef(tl, tl->t_defaultdir, R_BACKEND);
/* Check for orphans */
if (vcc_CheckReferences(tl))
return (vcc_DestroyTokenList(tl, NULL));
......
......@@ -88,6 +88,8 @@ struct tokenlist {
VTAILQ_HEAD(, acl_e) acl;
int defaultdir;
struct token *t_defaultdir;
struct token *t_dir;
struct token *t_policy;
......
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