r2360 - trunk/varnish-cache/lib/libvcl
phk at projects.linpro.no
phk at projects.linpro.no
Tue Jan 22 09:32:23 CET 2008
Author: phk
Date: 2008-01-22 09:32:23 +0100 (Tue, 22 Jan 2008)
New Revision: 2360
Modified:
trunk/varnish-cache/lib/libvcl/vcc_backend.c
Log:
Bail if there are multiple .host or .port fields in one backend host.
Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-01-22 08:28:18 UTC (rev 2359)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-01-22 08:32:23 UTC (rev 2360)
@@ -108,8 +108,8 @@
{
struct token *t_field;
struct token *t_first;
- struct token *t_host = NULL;
- struct token *t_port = NULL;
+ struct token *t_host = NULL, *t_fhost = NULL;
+ struct token *t_port = NULL, *t_fport = NULL;
const char *ep;
t_first = tl->t;
@@ -150,11 +150,33 @@
if (vcc_IdIs(t_field, "host")) {
ExpectErr(tl, CSTR);
assert(tl->t->dec != NULL);
+ if (t_host != NULL) {
+ vsb_printf(tl->sb,
+ "Multiple .host fields in backend: ");
+ vcc_ErrToken(tl, t_field);
+ vsb_printf(tl->sb, " at\n");
+ vcc_ErrWhere(tl, t_fhost);
+ vsb_printf(tl->sb, " and\n");
+ vcc_ErrWhere(tl, t_field);
+ return;
+ }
+ t_fhost = t_field;
t_host = tl->t;
vcc_NextToken(tl);
} else if (vcc_IdIs(t_field, "port")) {
ExpectErr(tl, CSTR);
assert(tl->t->dec != NULL);
+ if (t_port != NULL) {
+ vsb_printf(tl->sb,
+ "Multiple .port fields in backend: ");
+ vcc_ErrToken(tl, t_field);
+ vsb_printf(tl->sb, " at\n");
+ vcc_ErrWhere(tl, t_fport);
+ vsb_printf(tl->sb, " and\n");
+ vcc_ErrWhere(tl, t_field);
+ return;
+ }
+ t_fport = t_field;
t_port = tl->t;
vcc_NextToken(tl);
} else {
More information about the varnish-commit
mailing list