Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-re2
Commits
4a995c65
Commit
4a995c65
authored
Mar 16, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for the utf8 option
parent
4c0baa24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
encoding.vtc
src/tests/encoding.vtc
+69
-0
No files found.
src/tests/encoding.vtc
0 → 100644
View file @
4a995c65
# looks like -*- vcl -*-
varnishtest "latin1 and utf8 encoding"
# Tests from re2 testing/re2_test.cc
varnish v1 -vcl {
import re2 from "${vmod_topbuild}/src/.libs/libvmod_re2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new ninebytes = re2.regex("^.........$");
new threechars = re2.regex("^...$", utf8=true);
new capture_one_byte = re2.regex("(.)");
new capture_one_char = re2.regex("(.)", utf8=true);
new bytes = re2.regex({"^日扼語$"});
new chars = re2.regex({"^日扼語$"}, utf8=true);
new patternbytes = re2.regex({"^.扼.$"});
new patternchars = re2.regex({"^.扼.$"}, utf8=true);
}
sub vcl_recv {
return(synth(200));
}
sub vcl_synth {
if (ninebytes.match({"日扼語"})) {
set resp.http.ninebytes = "match";
}
if (threechars.match({"日扼語"})) {
set resp.http.threechars = "match";
}
if (capture_one_byte.match({"日扼語"})) {
if (capture_one_byte.backref(1) == {""}) {
set resp.http.captured_one_byte = "true";
}
}
if (capture_one_char.match({"日扼語"})) {
if (capture_one_char.backref(1) == {"日"}) {
set resp.http.captured_one_char = "true";
}
}
if (bytes.match({"日扼語"})) {
set resp.http.bytes = "match";
}
if (chars.match({"日扼語"})) {
set resp.http.chars = "match";
}
if (patternbytes.match({"日扼語"})) {
set resp.http.patternbytes = "match";
}
if (patternchars.match({"日扼語"})) {
set resp.http.patternchars = "match";
}
}
} -start
client c1 {
txreq
rxresp
expect resp.http.ninebytes == "match"
expect resp.http.threechars == "match"
expect resp.http.captured_one_byte == "true"
expect resp.http.captured_one_char == "true"
expect resp.http.bytes == "match"
expect resp.http.chars == "match"
expect resp.http.patternbytes == <undef>
expect resp.http.patternchars == "match"
} -run
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment