Commit fa4f94a8 authored by Geoff Simmons's avatar Geoff Simmons

add tests for utf8 encoding with the suball() function

parent 9bc5223d
......@@ -237,3 +237,50 @@ client c1 {
expect resp.http.patternbytes == "fallback"
expect resp.http.patternchars == "z"
} -run
# suball() function
varnish v1 -vcl {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
set resp.http.ninebytes =
re2.suball("^.........$",
{"日扼語"}, "z");
set resp.http.threechars =
re2.suball("^...$",
{"日扼語"}, "z",
utf8=true);
set resp.http.bytes =
re2.suball({"日扼語"},
{"日扼語"}, "z");
set resp.http.chars =
re2.suball({"日扼語"},
{"日扼語"}, "z",
utf8=true);
set resp.http.patternbytes =
re2.suball({"^.扼.$"},
{"日扼語"}, "z",
fallback="fallback");
set resp.http.patternchars =
re2.suball({"^.扼.$"},
{"日扼語"}, "z",
utf8=true);
}
}
client c1 {
txreq
rxresp
expect resp.http.ninebytes == "z"
expect resp.http.threechars == "z"
expect resp.http.bytes == "z"
expect resp.http.chars == "z"
expect resp.http.patternbytes == "fallback"
expect resp.http.patternchars == "z"
} -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