From 428e89bf653c15353806ce6a59be4826f9925934 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 5 Oct 2008 10:31:23 +0000 Subject: [PATCH] Make it possible to say: if (req.backend == b1) in VCL. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3246 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/lib/libvcl/vcc_parse.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/varnish-cache/lib/libvcl/vcc_parse.c b/varnish-cache/lib/libvcl/vcc_parse.c index 5f8e4d6e..3bfc4797 100644 --- a/varnish-cache/lib/libvcl/vcc_parse.c +++ b/varnish-cache/lib/libvcl/vcc_parse.c @@ -322,10 +322,29 @@ Cond_Bool(const struct var *vp, const struct tokenlist *tl) } static void -Cond_Backend(const struct var *vp, const struct tokenlist *tl) +Cond_Backend(const struct var *vp, struct tokenlist *tl) { Fb(tl, 1, "%s\n", vp->rname); + if (tl->t->tok == T_EQ) { + Fb(tl, 1, " ==\n"); + } else if (tl->t->tok == T_NEQ) { + Fb(tl, 1, " !=\n"); + } else { + vsb_printf(tl->sb, "Invalid condition "); + vcc_ErrToken(tl, tl->t); + vsb_printf(tl->sb, " on backend variable\n"); + vsb_printf(tl->sb, + " only '==' and '!=' are legal\n"); + vcc_ErrWhere(tl, tl->t); + return; + } + vcc_NextToken(tl); + vcc_ExpectCid(tl); + ERRCHK(tl); + vcc_AddRef(tl, tl->t, R_BACKEND); + Fb(tl, 1, "VGC_backend_%.*s\n", PF(tl->t)); + vcc_NextToken(tl); } static void -- 2.39.5