]> err.no Git - varnish/commitdiff
A simple ACL testcase
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 25 Jun 2008 21:22:13 +0000 (21:22 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 25 Jun 2008 21:22:13 +0000 (21:22 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2812 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/tests/c00005.vtc [new file with mode: 0644]

diff --git a/varnish-cache/bin/varnishtest/tests/c00005.vtc b/varnish-cache/bin/varnishtest/tests/c00005.vtc
new file mode 100644 (file)
index 0000000..ea0f4c1
--- /dev/null
@@ -0,0 +1,46 @@
+# $Id$
+
+test "Test simple ACL"
+
+server s1 {
+       rxreq
+       expect req.url == "/"
+       txresp -hdr "Content-Length: 5" -body "1111\n"
+       rxreq
+       expect req.url == "foo"
+       txresp -hdr "Content-Length: 5" -body "2222\n"
+} -start
+
+varnish v1 -vcl+backend {
+       acl acl1 {
+               "127.0.0.1";
+       }
+
+       sub vcl_recv {
+               if (client.ip ~ acl1) {
+                       set req.url = "/";
+               }
+       }
+} -start
+
+client c1 {
+       txreq -url "foo"
+       rxresp
+       expect resp.status == 200
+}
+
+client c1 -run
+
+varnish v1 -vcl+backend {
+       acl acl1 {
+               "!127.0.0.1";
+       }
+
+       sub vcl_recv {
+               if (client.ip ~ acl1) {
+                       set req.url = "/";
+               }
+       }
+}
+
+client c1 -run