Commit 3927a4f9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Finally pull together the courage to fix an old mistake of mine:

Rename 'purges' to 'bans' so that we can implement _real_ purges
also.

They really have been called 'bans' internally all the way through,
but for reasons now forgotten, we thought it would be too hard to
explain to people that purges were called bans in Varnish, so
the user-fronting side were named purges.

As it transpired, people were surprised that purges in varnish
did not free the storage right away, and various other kinds of
confusion also materialized.

The sky convinced me to implement real purges for efficiency
reasons when Vary is used, and of course now the name "purge"
was taken.

I'm sure people will curse about this change in the 2.x to 3.x
migration, but sooner or later it had to happen, and now it did.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5672 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 639c4a4c
......@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Ban ("purge") processing
* Ban processing
*
* A ban consists of a number of conditions (or tests), all of which must be
* satisfied. Here are some potential bans we could support:
......@@ -224,7 +224,7 @@ static const struct pvar {
ban_cond_f *func;
} pvars[] = {
#define PVAR(a, b, c) { (a), (b), (c) },
#include "purge_vars.h"
#include "ban_vars.h"
#undef PVAR
{ 0, 0, 0}
};
......@@ -323,11 +323,11 @@ BAN_Insert(struct ban *b)
Lck_Lock(&ban_mtx);
VTAILQ_INSERT_HEAD(&ban_head, b, list);
ban_start = b;
VSC_main->n_purge++;
VSC_main->n_purge_add++;
VSC_main->n_ban++;
VSC_main->n_ban_add++;
be = VTAILQ_LAST(&ban_head, banhead);
if (params->purge_dups && be != b)
if (params->ban_dups && be != b)
be->refcount++;
else
be = NULL;
......@@ -352,7 +352,7 @@ BAN_Insert(struct ban *b)
}
Lck_Lock(&ban_mtx);
be->refcount--;
VSC_main->n_purge_dups += pcount;
VSC_main->n_ban_dups += pcount;
Lck_Unlock(&ban_mtx);
}
......@@ -386,8 +386,8 @@ BAN_CheckLast(void)
Lck_AssertHeld(&ban_mtx);
b = VTAILQ_LAST(&ban_head, banhead);
if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) {
VSC_main->n_purge--;
VSC_main->n_purge_retire++;
VSC_main->n_ban--;
VSC_main->n_ban_retire++;
VTAILQ_REMOVE(&ban_head, b, list);
} else {
b = NULL;
......@@ -465,8 +465,8 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list);
b0->refcount++;
}
VSC_main->n_purge_obj_test++;
VSC_main->n_purge_re_test += tests;
VSC_main->n_ban_obj_test++;
VSC_main->n_ban_re_test += tests;
Lck_Unlock(&ban_mtx);
if (b == oc->ban) { /* not banned */
......@@ -637,8 +637,8 @@ BAN_Reload(double t0, unsigned flags, const char *ban)
break;
}
VSC_main->n_purge++;
VSC_main->n_purge_add++;
VSC_main->n_ban++;
VSC_main->n_ban_add++;
b2 = BAN_New();
AN(b2);
......@@ -699,7 +699,7 @@ BAN_Compile(void)
*/
static void
ccf_purge(struct cli *cli, const char * const *av, void *priv)
ccf_ban(struct cli *cli, const char * const *av, void *priv)
{
int narg, i;
struct ban *b;
......@@ -737,22 +737,22 @@ ccf_purge(struct cli *cli, const char * const *av, void *priv)
}
static void
ccf_purge_url(struct cli *cli, const char * const *av, void *priv)
ccf_ban_url(struct cli *cli, const char * const *av, void *priv)
{
const char *aav[6];
(void)priv;
aav[0] = NULL;
aav[1] = "purge";
aav[1] = "ban";
aav[2] = "req.url";
aav[3] = "~";
aav[4] = av[2];
aav[5] = NULL;
ccf_purge(cli, aav, priv);
ccf_ban(cli, aav, priv);
}
static void
ccf_purge_list(struct cli *cli, const char * const *av, void *priv)
ccf_ban_list(struct cli *cli, const char * const *av, void *priv)
{
struct ban *b, *bl = NULL;
......@@ -786,15 +786,9 @@ ccf_purge_list(struct cli *cli, const char * const *av, void *priv)
}
static struct cli_proto ban_cmds[] = {
/*
* XXX: COMPAT: Retain these two entries for entire 2.x series
* XXX: COMPAT: to stay compatible with 1.x series syntax.
*/
{ CLI_HIDDEN("url.purge", 1, 1) "h", ccf_purge_url },
{ CLI_PURGE_URL, "", ccf_purge_url },
{ CLI_PURGE, "", ccf_purge },
{ CLI_PURGE_LIST, "", ccf_purge_list },
{ CLI_BAN_URL, "", ccf_ban_url },
{ CLI_BAN, "", ccf_ban },
{ CLI_BAN_LIST, "", ccf_ban_list },
{ NULL }
};
......
......@@ -186,8 +186,8 @@ struct params {
double acceptor_sleep_incr;
double acceptor_sleep_decay;
/* Get rid of duplicate purges */
unsigned purge_dups;
/* Get rid of duplicate bans */
unsigned ban_dups;
/* How long time does the ban lurker sleep */
double ban_lurker_sleep;
......
......@@ -504,7 +504,7 @@ static const struct parspec input_parspec[] = {
"Objects already cached will not be affected by changes "
"made until they are fetched from the backend again.\n"
"To force an immediate effect at the expense of a total "
"flush of the cache use \"purge.url .\"",
"flush of the cache use \"ban.url .\"",
0,
"120", "seconds" },
{ "sess_workspace", tweak_uint, &master.sess_workspace, 1024, UINT_MAX,
......@@ -785,8 +785,8 @@ static const struct parspec input_parspec[] = {
"The TTL assigned to the synthesized error pages\n",
0,
"0", "seconds" },
{ "purge_dups", tweak_bool, &master.purge_dups, 0, 0,
"Detect and eliminate duplicate purges.\n",
{ "ban_dups", tweak_bool, &master.ban_dups, 0, 0,
"Detect and eliminate duplicate bans.\n",
0,
"on", "bool" },
{ "syslog_cli_traffic", tweak_bool, &master.syslog_cli_traffic, 0, 0,
......@@ -796,7 +796,7 @@ static const struct parspec input_parspec[] = {
{ "ban_lurker_sleep", tweak_timeout_double,
&master.ban_lurker_sleep, 0, UINT_MAX,
"How long time does the ban lurker thread sleeps between "
"successfull attempts to push the last item up the purge "
"successfull attempts to push the last item up the ban "
" list. It always sleeps a second when nothing can be done.\n"
"A value of zero disables the ban lurker.",
0,
......
......@@ -12,7 +12,7 @@ varnish v1 -cliok "help -d"
varnish v1 -cliok "help vcl.load"
varnish v1 -cliok "help purge"
varnish v1 -cliok "help ban"
varnish v1 -clierr 101 "FOO?"
......
......@@ -32,7 +32,7 @@ client c1 {
expect resp.bodylen == 6
} -run
varnish v1 -cliok "purge req.url ~ ."
varnish v1 -cliok "ban req.url ~ ."
client c1 {
txreq -url /1
......
......@@ -22,7 +22,7 @@ client c1 {
client c1 -run
varnish v1 -cli "purge.url foo"
varnish v1 -cli "ban.url foo"
client c1 {
txreq -url "/foo"
......
......@@ -2,4 +2,4 @@
test "Test banning a hash"
varnish v1 -arg "-b 127.0.0.1:80 -a 127.0.0.1:0" -start -clierr 101 "purge.hash foo"
varnish v1 -arg "-b 127.0.0.1:80 -a 127.0.0.1:0" -start -clierr 101 "ban.hash foo"
# $Id$
test "Check purge counters and duplicate purge elimination"
test "Check ban counters and duplicate ban elimination"
server s1 {
rxreq
......@@ -15,14 +15,14 @@ server s1 {
varnish v1 -vcl+backend {} -start
varnish v1 -cliok "purge.url FOO"
varnish v1 -cliok "ban.url FOO"
# There is one "magic" purge from boot
varnish v1 -expect n_purge_add == 2
varnish v1 -cliok "purge.list"
# There is one "magic" ban from boot
varnish v1 -expect n_ban_add == 2
varnish v1 -cliok "ban.list"
# Our fetch is not affected by the purge
# as the FOO-purge was preexisting
# Our fetch is not affected by the ban
# as the FOO-ban was preexisting
client c1 {
txreq -url /BAR
rxresp
......@@ -32,16 +32,16 @@ client c1 {
expect resp.http.foo == 1
} -run
varnish v1 -cliok "purge.list"
varnish v1 -expect n_purge_obj_test == 0
varnish v1 -expect n_purge_re_test == 0
varnish v1 -cliok "ban.list"
varnish v1 -expect n_ban_obj_test == 0
varnish v1 -expect n_ban_re_test == 0
# Add another purge
varnish v1 -cliok "purge.url FOO"
varnish v1 -expect n_purge_add == 3
varnish v1 -cliok "purge.list"
# Add another ban
varnish v1 -cliok "ban.url FOO"
varnish v1 -expect n_ban_add == 3
varnish v1 -cliok "ban.list"
# The cached object will be purged, and a new
# The cached object will be band, and a new
# fetched from the backend
client c1 {
txreq -url /FOO
......@@ -49,9 +49,9 @@ client c1 {
expect resp.http.foo == 2
} -run
varnish v1 -expect n_purge_obj_test == 1
varnish v1 -expect n_purge_re_test == 1
varnish v1 -cliok "purge.list"
varnish v1 -expect n_ban_obj_test == 1
varnish v1 -expect n_ban_re_test == 1
varnish v1 -cliok "ban.list"
# Fetch the cached copy, just for grins
client c1 {
......@@ -61,19 +61,19 @@ client c1 {
} -run
# Now add another two purges, Kilroy should not be hit
varnish v1 -cliok "purge.url KILROY"
varnish v1 -cliok "purge.url FOO"
varnish v1 -expect n_purge_add == 5
# Now add another two bans, Kilroy should not be hit
varnish v1 -cliok "ban.url KILROY"
varnish v1 -cliok "ban.url FOO"
varnish v1 -expect n_ban_add == 5
# Enable dup removal of purges
varnish v1 -cliok "param.set purge_dups on"
# Enable dup removal of bans
varnish v1 -cliok "param.set ban_dups on"
# This should incapacitate the two previous FOO purges.
varnish v1 -cliok "purge.url FOO"
varnish v1 -expect n_purge_add == 6
varnish v1 -expect n_purge_dups == 3
varnish v1 -cliok "purge.list"
# This should incapacitate the two previous FOO bans.
varnish v1 -cliok "ban.url FOO"
varnish v1 -expect n_ban_add == 6
varnish v1 -expect n_ban_dups == 3
varnish v1 -cliok "ban.list"
# And we should get a fresh object from backend
client c1 {
......@@ -83,10 +83,10 @@ client c1 {
} -run
# With only two objects having ever been compared
varnish v1 -expect n_purge_obj_test == 2
varnish v1 -expect n_purge_re_test == 2
varnish v1 -cliok "purge.list"
varnish v1 -expect n_ban_obj_test == 2
varnish v1 -expect n_ban_re_test == 2
varnish v1 -cliok "ban.list"
# Test a bogus regexp
varnish v1 -clierr 106 "purge.url [[["
varnish v1 -clierr 106 "ban.url [[["
# $Id$
test "Test banning a url with cli:purge"
test "Test banning a url with cli:ban"
server s1 {
rxreq
......@@ -31,17 +31,17 @@ client c1 {
} -run
# syntax checks
varnish v1 -clierr 104 "purge"
varnish v1 -clierr 104 "purge foo"
varnish v1 -clierr 104 "purge foo bar"
varnish v1 -clierr 106 "purge a b c && a"
varnish v1 -clierr 106 "purge a b c && a b"
varnish v1 -clierr 106 "purge a b c || a b c"
varnish v1 -cliok "purge.list"
varnish v1 -clierr 104 "ban"
varnish v1 -clierr 104 "ban foo"
varnish v1 -clierr 104 "ban foo bar"
varnish v1 -clierr 106 "ban a b c && a"
varnish v1 -clierr 106 "ban a b c && a b"
varnish v1 -clierr 106 "ban a b c || a b c"
varnish v1 -cliok "ban.list"
# exact match, not matching
varnish v1 -cliok "purge req.url == foo"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban req.url == foo"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
......@@ -52,8 +52,8 @@ client c1 {
} -run
# exact match, matching
varnish v1 -cliok "purge req.url == /foo"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban req.url == /foo"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
rxresp
......@@ -63,8 +63,8 @@ client c1 {
} -run
# regexp nonmatch
varnish v1 -cliok "purge req.url ~ bar"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban req.url ~ bar"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
......@@ -76,8 +76,8 @@ client c1 {
# regexp match
varnish v1 -cliok "purge req.url ~ foo"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban req.url ~ foo"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
......@@ -88,8 +88,8 @@ client c1 {
} -run
# header check, nonmatch
varnish v1 -cliok "purge obj.http.foo != bar7"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban obj.http.foo != bar7"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
......@@ -100,8 +100,8 @@ client c1 {
} -run
# header check, match
varnish v1 -cliok "purge req.http.foo == barcheck"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban req.http.foo == barcheck"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo" -hdr "foo: barcheck"
......@@ -112,8 +112,8 @@ client c1 {
} -run
# header check, no header
varnish v1 -cliok "purge req.url ~ foo && obj.http.bar == barcheck"
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban req.url ~ foo && obj.http.bar == barcheck"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
......
# $Id$
test "Test banning a url with VCL purge"
test "Test banning a url with VCL ban"
server s1 {
rxreq
......@@ -23,11 +23,11 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.request == "PURGE") {
purge (req.url == req.url);
ban (req.url == req.url);
error 410;
}
if (req.request == "PURGESTR") {
purge ("" + req.http.purge);
ban ("" + req.http.ban);
error 410;
}
}
......@@ -39,7 +39,7 @@ varnish v1 -badvcl {
.host = "127.0.0.1";
}
sub vcl_recv {
purge (req.foo == req.url);
ban (req.foo == req.url);
}
}
......@@ -49,7 +49,7 @@ varnish v1 -badvcl {
.host = "127.0.0.1";
}
sub vcl_recv {
purge (req.http. == req.url);
ban (req.http. == req.url);
}
}
......@@ -62,13 +62,13 @@ client c1 {
expect resp.bodylen == 5
} -run
# Purge something else
# Ban: something else
client c1 {
txreq -req PURGE -url /foox
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
# Still in cache
client c1 {
......@@ -79,13 +79,13 @@ client c1 {
expect resp.bodylen == 5
} -run
# Purge it
# Ban: it
client c1 {
txreq -req PURGE -url /foo
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
# New obj
client c1 {
......@@ -96,13 +96,13 @@ client c1 {
expect resp.bodylen == 6
} -run
# Purge everything else
# Ban: everything else
client c1 {
txreq -req PURGESTR -hdr "purge=req.url != /foo"
txreq -req PURGESTR -hdr "ban=req.url != /foo"
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
# still there
client c1 {
......@@ -113,13 +113,13 @@ client c1 {
expect resp.bodylen == 6
} -run
# Purge it
# Ban: it
client c1 {
txreq -req PURGESTR -hdr "Purge: obj.http.foo == \"bar6\""
txreq -req PURGESTR -hdr "Ban: obj.http.foo == \"bar6\""
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
# New one
client c1 {
......@@ -130,13 +130,13 @@ client c1 {
expect resp.bodylen == 7
} -run
# Purge something else
# Ban: something else
client c1 {
txreq -req PURGESTR -hdr "Purge: obj.http.foo == \"bar6\""
txreq -req PURGESTR -hdr "Ban: obj.http.foo == \"bar6\""
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
# Still there
client c1 {
......@@ -149,11 +149,11 @@ client c1 {
# Header match
client c1 {
txreq -req PURGESTR -hdr "Purge: req.http.foo == \"barcheck\""
txreq -req PURGESTR -hdr "Ban: req.http.foo == \"barcheck\""
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo" -hdr "foo: barcheck"
......@@ -165,11 +165,11 @@ client c1 {
# Header match
client c1 {
txreq -req PURGESTR -hdr "Purge: obj.http.foo == \"barcheck\""
txreq -req PURGESTR -hdr "Ban: obj.http.foo == \"barcheck\""
rxresp
expect resp.status == 410
} -run
varnish v1 -cliok "purge.list"
varnish v1 -cliok "ban.list"
client c1 {
txreq -url "/foo"
......
# $Id$
test "real purges"
test "real bans"
server s1 {
rxreq
......
......@@ -24,7 +24,7 @@ client c1 {
expect resp.http.foo == "foo"
} -run
varnish v1 -cliok "purge req.url == / && req.http.jam != session"
varnish v1 -cliok "ban req.url == / && req.http.jam != session"
varnish v1 -stop
server s1 -wait
......@@ -35,7 +35,7 @@ server s1 {
varnish v1 -start
varnish v1 -cliok purge.list
varnish v1 -cliok ban.list
# Count of 3 here, because two "magic" bans are also there"
varnish v1 -expect n_purge == 3
varnish v1 -expect n_ban == 3
......@@ -15,7 +15,7 @@ varnish v1 \
-arg "-pban_lurker_sleep=0" \
-vcl+backend { } -start
varnish v1 -cliok purge.list
varnish v1 -cliok ban.list
client c1 {
txreq -url "/"
......@@ -25,8 +25,8 @@ client c1 {
expect resp.http.foo == "foo"
} -run
varnish v1 -cliok "purge req.url == /"
varnish v1 -cliok purge.list
varnish v1 -cliok "ban req.url == /"
varnish v1 -cliok ban.list
varnish v1 -stop
server s1 -wait
......@@ -37,10 +37,10 @@ server s1 {
varnish v1 -vcl+backend {} -start
varnish v1 -cliok purge.list
varnish v1 -cliok ban.list
# Count of 2 here, because the "magic" ban is also there"
# varnish v1 -expect n_purge == 2
# varnish v1 -expect n_ban == 2
client c1 {
......@@ -52,7 +52,7 @@ client c1 {
} -run
varnish v1 -cliok purge.list
varnish v1 -cliok ban.list
varnish v1 -stop
# $Id$
test "multi element purge"
test "multi element ban"
server s1 {
rxreq
......@@ -11,7 +11,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
purge("req.url == / && obj.http.foo ~ bar1");
ban("req.url == / && obj.http.foo ~ bar1");
}
} -start
......@@ -27,4 +27,4 @@ client c1 {
expect resp.http.foo == "bar2"
} -run
varnish v1 -cliok purge.list
varnish v1 -cliok ban.list
......@@ -13,7 +13,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.request == "PURGE") {
purge_url("^/$");
ban_url("^/$");
error 209 "foo";
}
}
......
......@@ -88,17 +88,17 @@ varnish v1 -badvcl {
varnish v1 -badvcl {
backend b { .host = "127.0.0.1"; }
sub vcl_recv { purge_url (if); }
sub vcl_recv { ban_url (if); }
}
varnish v1 -badvcl {
backend b { .host = "127.0.0.1"; }
sub vcl_recv { purge_hash (if); }
sub vcl_recv { ban_hash (if); }
}
varnish v1 -vcl {
backend b { .host = "127.0.0.1"; }
sub vcl_recv { purge_url ("foo"); }
sub vcl_recv { ban_url ("foo"); }
}
varnish v1 -badvcl {
......
......@@ -11,6 +11,7 @@ pkginclude_HEADERS = \
nobase_noinst_HEADERS = \
argv.h \
ban_vars.h \
binary_heap.h \
cli.h \
cli_common.h \
......@@ -30,7 +31,6 @@ nobase_noinst_HEADERS = \
libvcl.h \
miniobj.h \
persistent.h \
purge_vars.h \
svnid.h \
vas.h \
vsha256.h \
......
......@@ -27,7 +27,7 @@
*
* $Id$
*
* Define which variables we can purge on, and which function does it.
* Define which variables we can ban on, and which function does it.
*
*/
......
......@@ -60,24 +60,24 @@
"\tReturns the TTL, size and checksum of the object.", \
1, 1
#define CLI_PURGE_URL \
"purge.url", \
"purge.url <regexp>", \
#define CLI_BAN_URL \
"ban.url", \
"ban.url <regexp>", \
"\tAll objects where the urls matches regexp will be " \
"marked obsolete.", \
1, 1
#define CLI_PURGE \
"purge", \
"purge <field> <operator> <arg> [&& <field> <oper> <arg>]...", \
#define CLI_BAN \
"ban", \
"ban <field> <operator> <arg> [&& <field> <oper> <arg>]...", \
"\tAll objects where the all the conditions match will be " \
"marked obsolete.", \
3, UINT_MAX
#define CLI_PURGE_LIST \
"purge.list", \
"purge.list", \
"\tList the active purges.", \
#define CLI_BAN_LIST \
"ban.list", \
"ban.list", \
"\tList the active bans.", \
0, 0
#define CLI_URL_STATUS \
......
......@@ -131,12 +131,12 @@ VSC_F(n_vcl, uint64_t, 0, 'a', "N vcl total")
VSC_F(n_vcl_avail, uint64_t, 0, 'a', "N vcl available")
VSC_F(n_vcl_discard, uint64_t, 0, 'a', "N vcl discarded")
VSC_F(n_purge, uint64_t, 0, 'i', "N total active purges")
VSC_F(n_purge_add, uint64_t, 0, 'a', "N new purges added")
VSC_F(n_purge_retire, uint64_t, 0, 'a', "N old purges deleted")
VSC_F(n_purge_obj_test, uint64_t, 0, 'a', "N objects tested")
VSC_F(n_purge_re_test, uint64_t, 0, 'a', "N regexps tested against")
VSC_F(n_purge_dups, uint64_t, 0, 'a', "N duplicate purges removed")
VSC_F(n_ban, uint64_t, 0, 'i', "N total active bans")
VSC_F(n_ban_add, uint64_t, 0, 'a', "N new bans added")
VSC_F(n_ban_retire, uint64_t, 0, 'a', "N old bans deleted")
VSC_F(n_ban_obj_test, uint64_t, 0, 'a', "N objects tested")
VSC_F(n_ban_re_test, uint64_t, 0, 'a', "N regexps tested against")
VSC_F(n_ban_dups, uint64_t, 0, 'a', "N duplicate bans removed")
VSC_F(hcb_nolock, uint64_t, 0, 'a', "HCB Lookups without lock")
VSC_F(hcb_lock, uint64_t, 0, 'a', "HCB Lookups with lock")
......
......@@ -179,20 +179,20 @@ parse_unset(struct vcc *tl)
/*--------------------------------------------------------------------*/
static const struct purge_var {
static const struct ban_var {
const char *name;
unsigned flag;
} purge_var[] = {
} ban_var[] = {
#define PVAR(a, b, c) { (a), (b) },
#include "purge_vars.h"
#include "ban_vars.h"
#undef PVAR
{ 0, 0 }
};
static void
parse_purge(struct vcc *tl)
parse_ban(struct vcc *tl)
{
const struct purge_var *pv;
const struct ban_var *pv;
vcc_NextToken(tl);
......@@ -205,14 +205,14 @@ parse_purge(struct vcc *tl)
while (1) {
ExpectErr(tl, ID);
/* Check valididity of purge variable */
for (pv = purge_var; pv->name != NULL; pv++) {
/* Check valididity of ban variable */
for (pv = ban_var; pv->name != NULL; pv++) {
if (!strncmp(pv->name, tl->t->b,
strlen(pv->name)))
break;
}
if (pv->name == NULL) {
vsb_printf(tl->sb, "Unknown purge variable.");
vsb_printf(tl->sb, "Unknown ban variable.");
vcc_ErrWhere(tl, tl->t);
return;
}
......@@ -265,7 +265,7 @@ parse_purge(struct vcc *tl)
/*--------------------------------------------------------------------*/
static void
parse_purge_url(struct vcc *tl)
parse_ban_url(struct vcc *tl)
{
vcc_NextToken(tl);
......@@ -405,8 +405,8 @@ static struct action_table {
{ "esi", parse_esi, VCL_MET_FETCH },
{ "hash_data", parse_hash_data, VCL_MET_HASH },
{ "panic", parse_panic },
{ "purge", parse_purge },
{ "purge_url", parse_purge_url },
{ "ban", parse_ban },
{ "ban_url", parse_ban_url },
{ "remove", parse_unset }, /* backward compatibility */
{ "return", parse_return },
{ "rollback", parse_rollback },
......
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