Commit be834827 authored by Geoff Simmons's avatar Geoff Simmons

test re-use of compiled set regexen

parent ce15e3dd
...@@ -10,6 +10,10 @@ varnish v1 -vcl+backend { ...@@ -10,6 +10,10 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new barbaz = re2.regex("(bar)(baz)"); new barbaz = re2.regex("(bar)(baz)");
new foobar = re2.set();
foobar.add("foo");
foobar.add("bar");
foobar.compile();
} }
sub vcl_recv { sub vcl_recv {
...@@ -24,6 +28,11 @@ varnish v1 -vcl+backend { ...@@ -24,6 +28,11 @@ varnish v1 -vcl+backend {
} else { } else {
set resp.status = 999; set resp.status = 999;
} }
if (foobar.match("foo")) {
set resp.http.foo3 = "match";
} else {
set resp.status = 999;
}
} }
} -start } -start
...@@ -35,6 +44,7 @@ client c1 { ...@@ -35,6 +44,7 @@ client c1 {
expect resp.http.foo0 == "barbaz" expect resp.http.foo0 == "barbaz"
expect resp.http.foo1 == "bar" expect resp.http.foo1 == "bar"
expect resp.http.foo2 == "baz" expect resp.http.foo2 == "baz"
expect resp.http.foo3 == "match"
} }
client c1 -run client c1 -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