Commit b8b1316c authored by Geoff Simmons's avatar Geoff Simmons

add tests for compile option alt_bsux

parent 219f3a94
......@@ -199,3 +199,96 @@ client c1 {
expect resp.http.r2-4 == "false"
expect resp.http.r2-5 == "false"
} -run
# alt_bsux
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("^a\x41z", alt_bsux=true);
new r2 = pcre2.regex("^a[m\x41]z", alt_bsux=true);
new r3 = pcre2.regex("^a\x1z", alt_bsux=true);
new r4 = pcre2.regex("^a\u0041z", alt_bsux=true);
new r5 = pcre2.regex("^a[m\u0041]z", alt_bsux=true);
new r6 = pcre2.regex("^a\u041z", alt_bsux=true);
new r7 = pcre2.regex("^a\U0041z", alt_bsux=true);
new r8 = pcre2.regex("^a\x41z");
new r9 = pcre2.regex("^a\x4z");
new r10 = pcre2.regex("^a\xz");
new r11 = pcre2.regex("^a\x4z", alt_bsux=true);
new r12 = pcre2.regex("^a\xz", alt_bsux=true);
}
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
set resp.http.r1-1 = r1.match("aAz");
set resp.http.r1-2 = r1.match("ax41z");
set resp.http.r2 = r2.match("aAz");
set resp.http.r3 = r3.match("ax1z");
set resp.http.r4-1 = r4.match("aAz");
set resp.http.r4-2 = r4.match("au0041z");
set resp.http.r5 = r5.match("aAz");
set resp.http.r6-1 = r6.match("au041z");
set resp.http.r6-2 = r6.match("aAz");
set resp.http.r7-1 = r7.match("aU0041z");
set resp.http.r7-2 = r7.match("aAz");
set resp.http.r8-1 = r8.match("aAz");
set resp.http.r8-2 = r8.match("ax41z");
set resp.http.r9-1 = r9.match("az");
set resp.http.r9-2 = r9.match("ax4z");
# pcre2 would match "\xz" in r10 with alt_bsux=false
# to binary 0 followed by z, but we cannot have a null
# byte in a VCL string.
set resp.http.r10 = r10.match("axz");
set resp.http.r11-1 = r11.match("az");
set resp.http.r11-2 = r11.match("ax4z");
set resp.http.r12 = r12.match("axz");
}
}
client c1 {
txreq
rxresp
expect resp.status == "200"
expect resp.http.r1-1 == "true"
expect resp.http.r1-2 == "false"
expect resp.http.r2 == "true"
expect resp.http.r3 == "true"
expect resp.http.r4-1 == "true"
expect resp.http.r4-2 == "false"
expect resp.http.r5 == "true"
expect resp.http.r6-1 == "true"
expect resp.http.r6-2 == "false"
expect resp.http.r7-1 == "true"
expect resp.http.r7-2 == "false"
expect resp.http.r8-1 == "true"
expect resp.http.r8-2 == "false"
expect resp.http.r9-1 == "true"
expect resp.http.r9-2 == "false"
expect resp.http.r10 == "false"
expect resp.http.r11-1 == "false"
expect resp.http.r11-2 == "true"
expect resp.http.r12 == "true"
} -run
varnish v1 -errvcl {vmod pcre2 error: Cannot compile '^a\U0041z' in r constructor: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 4} {
import pcre2 from "${vmod_topbuild}/src/.libs/libvmod_pcre2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new r = pcre2.regex("^a\U0041z");
}
}
varnish v1 -errvcl {vmod pcre2 error: Cannot compile '^a\u0041z' in r constructor: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 4} {
import pcre2 from "${vmod_topbuild}/src/.libs/libvmod_pcre2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new r = pcre2.regex("^a\u0041z");
}
}
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