r4249 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Mon Sep 28 11:56:02 CEST 2009
Author: tfheen
Date: 2009-09-28 11:56:02 +0200 (Mon, 28 Sep 2009)
New Revision: 4249
Added:
branches/2.0/varnish-cache/bin/varnishtest/tests/r00502.vtc
Modified:
branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c
Log:
Merge r4048: Fix a parse error in VCL:purge() string version.
Fixes #502
Modified: branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c 2009-09-28 09:46:59 UTC (rev 4248)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c 2009-09-28 09:56:02 UTC (rev 4249)
@@ -130,7 +130,9 @@
return (p);
}
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * XXX: Optimize the single element case ?
+ */
/*lint -e{818} ap,hp could be const */
static char *
@@ -862,20 +864,25 @@
}
b = BAN_New();
good = 0;
- for (i = 1; ; i += 3) {
- a1 = av[i];
+ for (i = 1; ;) {
+ a1 = av[i++];
if (a1 == NULL)
break;
good = 0;
- a2 = av[i + 1];
+ a2 = av[i++];
if (a2 == NULL)
break;
- a3 = av[i + 2];
+ a3 = av[i++];
if (a3 == NULL)
break;
if (BAN_AddTest(NULL, b, a1, a2, a3))
break;
good = 1;
+ if (av[i] == NULL)
+ break;
+ good = 0;
+ if (strcmp(av[i++], "&&"))
+ break;
}
if (!good)
/* XXX: report error how ? */
Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/r00502.vtc (from rev 4048, trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc)
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/r00502.vtc (rev 0)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/r00502.vtc 2009-09-28 09:56:02 UTC (rev 4249)
@@ -0,0 +1,30 @@
+# $Id$
+
+test "multi element purge"
+
+server s1 {
+ rxreq
+ txresp -hdr "foo: bar1" -body "1"
+ rxreq
+ txresp -hdr "foo: bar2" -body "22"
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ purge("req.url == / && obj.http.foo ~ bar1");
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.http.foo == "bar1"
+ txreq
+ rxresp
+ expect resp.http.foo == "bar2"
+ txreq
+ rxresp
+ expect resp.http.foo == "bar2"
+} -run
+
+varnish v1 -cliok purge.list
More information about the varnish-commit
mailing list