Commit 88339bce authored by Geoff Simmons's avatar Geoff Simmons

add set objects to the simple match test

parent 619bb94b
...@@ -12,6 +12,9 @@ varnish v1 -vcl+backend { ...@@ -12,6 +12,9 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new bar = re2.regex("bar"); new bar = re2.regex("bar");
new barset = re2.set();
barset.add("bar");
barset.compile();
} }
sub vcl_backend_response { sub vcl_backend_response {
...@@ -38,6 +41,18 @@ varnish v1 -vcl+backend { ...@@ -38,6 +41,18 @@ varnish v1 -vcl+backend {
} else { } else {
set beresp.status = 999; set beresp.status = 999;
} }
if (barset.match(beresp.http.foo)) {
set beresp.http.foo1s = "1";
} else {
set beresp.status = 999;
}
if (!barset.match(beresp.http.bar)) {
set beresp.http.bar1s = "2";
} else {
set beresp.status = 999;
}
} }
} -start } -start
...@@ -50,4 +65,6 @@ client c1 { ...@@ -50,4 +65,6 @@ client c1 {
expect resp.http.bar1 == "2" expect resp.http.bar1 == "2"
expect resp.http.foo1f == "1" expect resp.http.foo1f == "1"
expect resp.http.bar1f == "2" expect resp.http.bar1f == "2"
expect resp.http.foo1s == "1"
expect resp.http.bar1s == "2"
} -run } -run
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