Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-re
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-re
Commits
951a2a57
Commit
951a2a57
authored
Sep 27, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test c04 -- standard VCL regex stuff doesn't affect re.backref
parent
d939a224
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
c04.vtc
src/tests/c04.vtc
+53
-0
No files found.
src/tests/c04.vtc
0 → 100644
View file @
951a2a57
varnishtest "re.backref not affected by standard VCL regex code"
server s1 {
rxreq
txresp -hdr "Foo: barbaz" -body "1111\n"
} -start
varnish v1 -vcl+backend {
import re from "${vmod_topbuild}/src/.libs/libvmod_re.so";
sub vcl_fetch {
if (!re.match(beresp.http.foo, "(bar)baz")) {
error 503;
}
if (beresp.http.foo ~ "bar(baz)") {
set beresp.http.tilde0 = re.backref(0, "tilde0");
set beresp.http.tilde1 = re.backref(1, "tilde1");
} else {
error 999;
}
if (beresp.http.foo !~ "bar(quux)") {
set beresp.http.neg0 = re.backref(0, "neg0");
set beresp.http.neg1 = re.backref(1, "neg1");
} else {
error 999;
}
set beresp.http.bar = regsub(beresp.http.foo, "bar(baz)", "\1");
set beresp.http.regsub0 = re.backref(0, "regsub0");
set beresp.http.regsub1 = re.backref(1, "regsub1");
set beresp.http.bar = regsuball(beresp.http.foo, "(.)", "x");
set beresp.http.regsuball0 = re.backref(0, "regsuball0");
set beresp.http.regsuball1 = re.backref(1, "regsuball1");
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.tilde0 == "barbaz"
expect resp.http.tilde1 == "bar"
expect resp.http.neg0 == "barbaz"
expect resp.http.neg1 == "bar"
expect resp.http.regsub0 == "barbaz"
expect resp.http.regsub1 == "bar"
expect resp.http.regsuball0 == "barbaz"
expect resp.http.regsuball1 == "bar"
} -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