Commit 9bd84fe2 authored by Geoff Simmons's avatar Geoff Simmons

add a test for compile option firstline

parent 7d82ddb7
......@@ -408,3 +408,57 @@ client c1 {
expect resp.http.r3 == "true"
expect resp.http.r4 == "false"
} -run
# XXX test for dupnames will require capturing named refs
# extended option is tested in compile.vtc and match.vtc
# firstline
varnish v1 -vcl {
import pcre2 from "${vmod_topbuild}/src/.libs/libvmod_pcre2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new r1 = pcre2.regex({"line
break"});
new r2 = pcre2.regex(firstline=true, pattern={"line
break"});
new r3 = pcre2.regex(firstline=true, multiline=true,
pattern={"line
break"});
}
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
set resp.http.r1-1 = r1.match({"line
break"});
set resp.http.r2-1 = r2.match({"line
break"});
set resp.http.r3-1 = r3.match({"line
break"});
set resp.http.r1-2 = r1.match({"line one
this is a line
break in the second line"});
set resp.http.r2-2 = r2.match({"line one
this is a line
break in the second line"});
set resp.http.r3-2 = r3.match({"line one
this is a line
break in the second line"});
}
}
client c1 {
txreq
rxresp
expect resp.status == "200"
expect resp.http.r1-1 == "true"
expect resp.http.r1-2 == "true"
expect resp.http.r2-1 == "true"
expect resp.http.r2-2 == "false"
expect resp.http.r3-1 == "true"
expect resp.http.r3-2 == "false"
} -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