[master] 5972f08 Reallow '-' in VCL names by popular demand.
Poul-Henning Kamp
phk at FreeBSD.org
Fri Sep 9 18:05:13 CEST 2016
commit 5972f08200989863bc0b062af215f75d621838fc
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Sep 9 16:03:31 2016 +0000
Reallow '-' in VCL names by popular demand.
Pass childs status on failure
Make atexit more robust
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 2a4f938..323f942 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -103,7 +103,10 @@ mcf_bad_vclname(struct cli *cli, const char *name)
if (!vct_isalpha(*p))
bad = *p;
for (p++; bad == 0 && *p != '\0'; p++)
- if (!vct_isalpha(*p) && !vct_isdigit(*p) && *p != '_')
+ if (!vct_isalpha(*p) &&
+ !vct_isdigit(*p) &&
+ *p != '_' &&
+ *p != '-')
bad = *p;
if (bad) {
VCLI_SetResult(cli, CLIS_PARAM);
@@ -213,6 +216,8 @@ mgt_vcl_del(struct vclprog *vp)
char *p;
CHECK_OBJ_NOTNULL(vp, VCLPROG_MAGIC);
+ while (!VTAILQ_EMPTY(&vp->dto))
+ mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dto));
while (!VTAILQ_EMPTY(&vp->dfrom))
mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dfrom));
@@ -352,7 +357,7 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
vp->name, vp->fname, vp->warm, vp->state)) {
mgt_vcl_del(vp);
VCLI_Out(cli, "%s", p);
- VCLI_SetResult(cli, CLIS_PARAM);
+ VCLI_SetResult(cli, status);
}
free(p);
}
@@ -748,6 +753,7 @@ mgt_vcl_atexit(void)
if (getpid() != mgt_pid)
return;
+ active_vcl = NULL;
do {
vp = VTAILQ_FIRST(&vclhead);
if (vp != NULL)
diff --git a/bin/varnishtest/tests/v00048.vtc b/bin/varnishtest/tests/v00048.vtc
index 25cf629..7f35402 100644
--- a/bin/varnishtest/tests/v00048.vtc
+++ b/bin/varnishtest/tests/v00048.vtc
@@ -73,16 +73,16 @@ varnish v1 -clierr 106 "vcl.discard foo"
varnish v1 -stop
varnish v1 -cliok "vcl.list"
-varnish v1 -clierr 106 "vcl.label foo vcl0"
-varnish v1 -cliok "vcl.label foo vcl1"
-varnish v1 -clierr 300 "vcl.label bar foo"
+varnish v1 -clierr 106 "vcl.label fo- vcl0"
+varnish v1 -cliok "vcl.label fo- vcl1"
+varnish v1 -clierr 300 "vcl.label bar fo-"
varnish v1 -clierr 200 "vcl.state vcl1 warm"
varnish v1 -clierr 200 "vcl.state vcl1 auto"
varnish v1 -clierr 300 "vcl.state vcl1 cold"
varnish v1 -clierr 300 "vcl.discard vcl1"
varnish v1 -cliok "vcl.list"
-varnish v1 -cliok "vcl.use foo"
-varnish v1 -clierr 300 "vcl.discard foo"
+varnish v1 -cliok "vcl.use fo-"
+varnish v1 -clierr 300 "vcl.discard fo-"
varnish v1 -cliok "vcl.list"
server s1 -start
@@ -91,8 +91,8 @@ varnish v1 -start
client c1 -run
varnish v1 -stop
varnish v1 -cliok "vcl.use vcl1"
-varnish v1 -cliok "vcl.discard foo"
-varnish v1 -clierr 106 "vcl.discard foo"
+varnish v1 -cliok "vcl.discard fo-"
+varnish v1 -clierr 106 "vcl.discard fo-"
varnish v1 -start
varnish v1 -cliok "vcl.label snarf vcl1"
More information about the varnish-commit
mailing list