]> err.no Git - varnish/commitdiff
Make it possible to say:
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 5 Oct 2008 10:31:23 +0000 (10:31 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 5 Oct 2008 10:31:23 +0000 (10:31 +0000)
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

index 5f8e4d6e27b12608f44dfac5c57ecf6e79656073..3bfc4797a7cfa6cb3664d2b1a6ea64ee0fddae47 100644 (file)
@@ -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