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
Nils Goroll
libvmod-re
Commits
7bcd7cce
Commit
7bcd7cce
authored
Sep 11, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
match now checks for regex compilation errors, and logs them if needed
parent
ff4d7838
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
b05.vtc
src/tests/b05.vtc
+23
-0
vmod_re.c
src/vmod_re.c
+14
-3
No files found.
src/tests/b05.vtc
0 → 100644
View file @
7bcd7cce
varnishtest "regex compilation failre"
server s1 {
rxreq
txresp -hdr "Foo: bar" -body "foobar"
} -start
varnish v1 -vcl+backend {
import re from "${vmod_topbuild}/src/.libs/libvmod_re.so";
sub vcl_fetch {
if (re.match(beresp.http.foo, "(")) {
set beresp.http.foo = "baz";
}
}
} -start
client c1 {
txreq
rxresp
expect resp.http.content-length == 6
expect resp.http.foo == "bar"
} -run
src/vmod_re.c
View file @
7bcd7cce
...
...
@@ -127,15 +127,26 @@ vmod_match(struct sess *sp, struct vmod_priv *priv_vcl,
str
=
""
;
if
(
priv_call
->
priv
==
NULL
)
{
int
erroffset
=
0
;
const
char
*
error
=
NULL
;
AZ
(
pthread_mutex_lock
(
&
re_mutex
));
if
(
priv_call
->
priv
==
NULL
)
{
VRT_re_init
(
&
priv_call
->
priv
,
pattern
);
priv_call
->
priv
=
VRE_compile
(
pattern
,
0
,
&
error
,
&
erroffset
);
if
(
priv_call
->
priv
==
NULL
)
WSP
(
sp
,
SLT_VCL_error
,
"vmod re: error compiling regex [%s]: "
"%s at position %d"
,
pattern
,
error
,
erroffset
);
else
priv_call
->
free
=
VRT_re_fini
;
}
AZ
(
pthread_mutex_unlock
(
&
re_mutex
));
}
re
=
(
vre_t
*
)
priv_call
->
priv
;
AN
(
re
);
if
(
re
==
NULL
)
return
0
;
s
=
VRE_exec
(
re
,
str
,
strlen
(
str
),
0
,
0
,
&
tbl
->
sess
[
sp
->
id
].
ovector
[
0
],
MAX_OV
,
&
params
->
vre_limits
);
...
...
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