[master] dd4c1ed Don't interpret \ escapes in ban strings from vcl::ban()

Poul-Henning Kamp phk at varnish-cache.org
Wed May 18 11:38:17 CEST 2011


commit dd4c1ed0b7e25d088ab1f50ce3444f8d087eb31d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed May 18 09:37:36 2011 +0000

    Don't interpret \ escapes in ban strings from vcl::ban()

diff --git a/bin/varnishd/cache_vrt.c b/bin/varnishd/cache_vrt.c
index c20e243..d66c66c 100644
--- a/bin/varnishd/cache_vrt.c
+++ b/bin/varnishd/cache_vrt.c
@@ -467,7 +467,7 @@ VRT_ban_string(struct sess *sp, const char *str)
 	int i;
 
 	(void)sp;
-	av = ParseArgv(str, NULL, 0);
+	av = ParseArgv(str, NULL, ARGV_NOESC);
 	if (av[0] != NULL) {
 		/* XXX: report error how ? */
 		FreeArgv(av);
diff --git a/bin/varnishtest/tests/c00022.vtc b/bin/varnishtest/tests/c00022.vtc
index ca64e59..33e20cc 100644
--- a/bin/varnishtest/tests/c00022.vtc
+++ b/bin/varnishtest/tests/c00022.vtc
@@ -93,7 +93,7 @@ client c1 {
 
 # Ban: it
 client c1 {
-	txreq -req PURGESTR -hdr "Ban: obj.http.foo == \"bar6\""
+	txreq -req PURGESTR -hdr "Ban: obj.http.foo == bar6"
 	rxresp
 	expect resp.status == 410
 } -run
@@ -110,10 +110,11 @@ client c1 {
 
 # Ban: something else
 client c1 {
-	txreq -req PURGESTR -hdr "Ban: obj.http.foo == \"bar6\""
+	txreq -req PURGESTR -hdr "Ban: obj.http.foo == bar6"
 	rxresp
 	expect resp.status == 410
 } -run
+
 varnish v1 -cliok "ban.list"
 
 # Still there
@@ -127,7 +128,7 @@ client c1 {
 
 # Header match
 client c1 {
-	txreq -req PURGESTR -hdr "Ban: req.http.foo == \"barcheck\""
+	txreq -req PURGESTR -hdr "Ban: req.http.foo == barcheck"
 	rxresp
 	expect resp.status == 410
 } -run
@@ -143,7 +144,7 @@ client c1 {
 
 # Header match
 client c1 {
-	txreq -req PURGESTR -hdr "Ban: obj.http.foo == \"barcheck\""
+	txreq -req PURGESTR -hdr "Ban: obj.http.foo == barcheck"
 	rxresp
 	expect resp.status == 410
 } -run



More information about the varnish-commit mailing list