Commit 5a772c28 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r4048: Fix a parse error in VCL:purge() string version.

Fixes #502



git-svn-id: http://www.varnish-cache.org/svn/branches/2.0@4249 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 8503b3fb
......@@ -130,7 +130,9 @@ VRT_GetHdr(const struct sess *sp, enum gethdr_e where, const char *n)
return (p);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------
* XXX: Optimize the single element case ?
*/
/*lint -e{818} ap,hp could be const */
static char *
......@@ -862,20 +864,25 @@ VRT_purge_string(struct sess *sp, char *str, ...)
}
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 ? */
......
# $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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment