r5672 - in trunk/varnish-cache: bin/varnishd bin/varnishtest/tests include lib/libvcl

phk at varnish-cache.org phk at varnish-cache.org
Mon Jan 3 10:17:47 CET 2011


Author: phk
Date: 2011-01-03 10:17:47 +0100 (Mon, 03 Jan 2011)
New Revision: 5672

Added:
   trunk/varnish-cache/include/ban_vars.h
Removed:
   trunk/varnish-cache/include/purge_vars.h
Modified:
   trunk/varnish-cache/bin/varnishd/cache_ban.c
   trunk/varnish-cache/bin/varnishd/heritage.h
   trunk/varnish-cache/bin/varnishd/mgt_param.c
   trunk/varnish-cache/bin/varnishtest/tests/b00008.vtc
   trunk/varnish-cache/bin/varnishtest/tests/b00033.vtc
   trunk/varnish-cache/bin/varnishtest/tests/c00006.vtc
   trunk/varnish-cache/bin/varnishtest/tests/c00007.vtc
   trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc
   trunk/varnish-cache/bin/varnishtest/tests/c00021.vtc
   trunk/varnish-cache/bin/varnishtest/tests/c00022.vtc
   trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc
   trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc
   trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc
   trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc
   trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc
   trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc
   trunk/varnish-cache/include/Makefile.am
   trunk/varnish-cache/include/cli.h
   trunk/varnish-cache/include/vsc_fields.h
   trunk/varnish-cache/lib/libvcl/vcc_action.c
Log:
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.



Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.c	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.c	2011-01-03 09:17:47 UTC (rev 5672)
@@ -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 @@
 	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 @@
 	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 @@
 	}
 	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 @@
 	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 @@
 		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 @@
 			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 @@
  */
 
 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 @@
 }
 
 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 @@
 }
 
 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 }
 };
 

Modified: trunk/varnish-cache/bin/varnishd/heritage.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/heritage.h	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishd/heritage.h	2011-01-03 09:17:47 UTC (rev 5672)
@@ -186,8 +186,8 @@
 	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;

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c	2011-01-03 09:17:47 UTC (rev 5672)
@@ -504,7 +504,7 @@
 		"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 @@
 		"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 @@
 	{ "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,

Modified: trunk/varnish-cache/bin/varnishtest/tests/b00008.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/b00008.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/b00008.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -12,7 +12,7 @@
 
 varnish v1 -cliok "help vcl.load"
 
-varnish v1 -cliok "help purge"
+varnish v1 -cliok "help ban"
 
 varnish v1 -clierr 101 "FOO?"
 

Modified: trunk/varnish-cache/bin/varnishtest/tests/b00033.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/b00033.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/b00033.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -32,7 +32,7 @@
 	expect resp.bodylen == 6
 } -run
 
-varnish v1 -cliok "purge req.url ~ ."
+varnish v1 -cliok "ban req.url ~ ."
 	
 client c1 {
 	txreq -url /1

Modified: trunk/varnish-cache/bin/varnishtest/tests/c00006.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00006.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00006.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -22,7 +22,7 @@
 
 client c1 -run
 
-varnish v1 -cli "purge.url foo"
+varnish v1 -cli "ban.url foo"
 
 client c1 {
 	txreq -url "/foo"

Modified: trunk/varnish-cache/bin/varnishtest/tests/c00007.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00007.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00007.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -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"

Modified: trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -1,6 +1,6 @@
 # $Id$
 
-test "Check purge counters and duplicate purge elimination"
+test "Check ban counters and duplicate ban elimination"
 
 server s1 {
 	rxreq
@@ -15,14 +15,14 @@
 
 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 @@
 	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 @@
 	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 @@
 } -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 @@
 } -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 [[["

Modified: trunk/varnish-cache/bin/varnishtest/tests/c00021.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00021.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00021.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -1,6 +1,6 @@
 # $Id$
 
-test "Test banning a url with cli:purge"
+test "Test banning a url with cli:ban"
 
 server s1 {
 	rxreq
@@ -31,17 +31,17 @@
 } -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 @@
 } -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 @@
 } -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 @@
 
 
 # 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 @@
 } -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 @@
 } -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 @@
 } -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"

Modified: trunk/varnish-cache/bin/varnishtest/tests/c00022.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00022.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00022.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -1,6 +1,6 @@
 # $Id$
 
-test "Test banning a url with VCL purge"
+test "Test banning a url with VCL ban"
 
 server s1 {
 	rxreq
@@ -23,11 +23,11 @@
 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 @@
 		.host = "127.0.0.1";
 	}
 	sub vcl_recv {
-		purge (req.foo == req.url);
+		ban (req.foo == req.url);
 	}
 }
 
@@ -49,7 +49,7 @@
 		.host = "127.0.0.1";
 	}
 	sub vcl_recv {
-		purge (req.http. == req.url);
+		ban (req.http. == req.url);
 	}
 }
 
@@ -62,13 +62,13 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 
 # 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 @@
 
 # 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"

Modified: trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -1,6 +1,6 @@
 # $Id$
 
-test "real purges"
+test "real bans"
 
 server s1 {
 	rxreq

Modified: trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -24,7 +24,7 @@
 	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 @@
 
 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

Modified: trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -15,7 +15,7 @@
 	-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 @@
 	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 @@
 
 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 @@
 } -run
 
 
-varnish v1 -cliok purge.list
+varnish v1 -cliok ban.list
 
 varnish v1 -stop
 

Modified: trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -1,6 +1,6 @@
 # $Id$
 
-test "multi element purge"
+test "multi element ban"
 
 server s1 {
 	rxreq
@@ -11,7 +11,7 @@
 
 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 @@
 	expect resp.http.foo == "bar2"
 } -run
 
-varnish v1 -cliok purge.list
+varnish v1 -cliok ban.list

Modified: trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -13,7 +13,7 @@
 varnish v1 -vcl+backend { 
 	sub vcl_recv {
 		if (req.request == "PURGE") {
-			purge_url("^/$");
+			ban_url("^/$");
 			error 209 "foo";
 		}
 	}

Modified: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc	2011-01-03 09:17:47 UTC (rev 5672)
@@ -88,17 +88,17 @@
 
 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 {

Modified: trunk/varnish-cache/include/Makefile.am
===================================================================
--- trunk/varnish-cache/include/Makefile.am	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/include/Makefile.am	2011-01-03 09:17:47 UTC (rev 5672)
@@ -11,6 +11,7 @@
 
 nobase_noinst_HEADERS = \
 	argv.h \
+	ban_vars.h \
 	binary_heap.h \
 	cli.h \
 	cli_common.h \
@@ -30,7 +31,6 @@
 	libvcl.h \
 	miniobj.h \
 	persistent.h \
-	purge_vars.h \
 	svnid.h \
 	vas.h \
 	vsha256.h \

Copied: trunk/varnish-cache/include/ban_vars.h (from rev 5671, trunk/varnish-cache/include/purge_vars.h)
===================================================================
--- trunk/varnish-cache/include/ban_vars.h	                        (rev 0)
+++ trunk/varnish-cache/include/ban_vars.h	2011-01-03 09:17:47 UTC (rev 5672)
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (c) 2008-2009 Linpro AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ *
+ * Define which variables we can ban on, and which function does it.
+ *
+ */
+
+#define PVAR_HTTP	1
+#define PVAR_REQ	2
+
+PVAR("req.url",		PVAR_REQ,		ban_cond_url)
+PVAR("req.http.",	PVAR_REQ|PVAR_HTTP,	ban_cond_req_http)
+PVAR("obj.http.",	PVAR_HTTP,		ban_cond_obj_http)

Modified: trunk/varnish-cache/include/cli.h
===================================================================
--- trunk/varnish-cache/include/cli.h	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/include/cli.h	2011-01-03 09:17:47 UTC (rev 5672)
@@ -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							\

Deleted: trunk/varnish-cache/include/purge_vars.h
===================================================================
--- trunk/varnish-cache/include/purge_vars.h	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/include/purge_vars.h	2011-01-03 09:17:47 UTC (rev 5672)
@@ -1,39 +0,0 @@
-/*-
- * Copyright (c) 2008-2009 Linpro AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id$
- *
- * Define which variables we can purge on, and which function does it.
- *
- */
-
-#define PVAR_HTTP	1
-#define PVAR_REQ	2
-
-PVAR("req.url",		PVAR_REQ,		ban_cond_url)
-PVAR("req.http.",	PVAR_REQ|PVAR_HTTP,	ban_cond_req_http)
-PVAR("obj.http.",	PVAR_HTTP,		ban_cond_obj_http)

Modified: trunk/varnish-cache/include/vsc_fields.h
===================================================================
--- trunk/varnish-cache/include/vsc_fields.h	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/include/vsc_fields.h	2011-01-03 09:17:47 UTC (rev 5672)
@@ -131,12 +131,12 @@
 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")

Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_action.c	2010-12-31 12:46:11 UTC (rev 5671)
+++ trunk/varnish-cache/lib/libvcl/vcc_action.c	2011-01-03 09:17:47 UTC (rev 5672)
@@ -179,20 +179,20 @@
 
 /*--------------------------------------------------------------------*/
 
-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 @@
 		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 @@
 /*--------------------------------------------------------------------*/
 
 static void
-parse_purge_url(struct vcc *tl)
+parse_ban_url(struct vcc *tl)
 {
 
 	vcc_NextToken(tl);
@@ -405,8 +405,8 @@
 	{ "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 },




More information about the varnish-commit mailing list