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
0ee2f4ae
Unverified
Commit
0ee2f4ae
authored
Oct 26, 2021
by
Nils Goroll
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the VCL_REGEX type
parent
6a7486c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
16 deletions
+5
-16
b05.vtc
src/tests/b05.vtc
+1
-1
vmod_re.c
src/vmod_re.c
+3
-14
vmod_re.vcc
src/vmod_re.vcc
+1
-1
No files found.
src/tests/b05.vtc
View file @
0ee2f4ae
...
...
@@ -2,7 +2,7 @@ varnishtest "regex constructor errors"
varnish v1 -vcl { backend b { .host = "${bad_ip}"; } } -start
varnish v1 -errvcl {
vmod re: error compiling regex
} {
varnish v1 -errvcl {
Regexp compilation error
} {
import re from "${vmod_topbuild}/src/.libs/libvmod_re.so";
backend b { .host = "${bad_ip}"; }
...
...
src/vmod_re.c
View file @
0ee2f4ae
...
...
@@ -48,7 +48,7 @@
struct
vmod_re_regex
{
unsigned
magic
;
#define VMOD_RE_REGEX_MAGIC 0x955706ee
vre_t
*
vre
;
VCL_REGEX
vre
;
struct
vre_limits
vre_limits
;
};
...
...
@@ -94,10 +94,9 @@ re_compile(const char *pattern, unsigned options, char *errbuf,
VCL_VOID
vmod_regex__init
(
VRT_CTX
,
struct
vmod_re_regex
**
rep
,
const
char
*
vcl_name
,
VCL_
STRING
pattern
,
VCL_INT
limit
,
VCL_INT
limit_recursion
)
VCL_
REGEX
vre
,
VCL_INT
limit
,
VCL_INT
limit_recursion
)
{
struct
vmod_re_regex
*
re
;
vre_t
*
vre
;
char
errbuf
[
VRE_ERROR_LEN
];
int
erroffset
;
const
char
*
error
;
...
...
@@ -106,7 +105,7 @@ vmod_regex__init(VRT_CTX, struct vmod_re_regex **rep, const char *vcl_name,
AN
(
rep
);
AZ
(
*
rep
);
AN
(
vcl_name
);
AN
(
pattern
);
AN
(
vre
);
if
(
limit
<
1
)
{
VRT_fail
(
ctx
,
"vmod re: invalid limit %ld in %s constructor"
,
...
...
@@ -120,14 +119,6 @@ vmod_regex__init(VRT_CTX, struct vmod_re_regex **rep, const char *vcl_name,
return
;
}
vre
=
re_compile
(
pattern
,
0
,
errbuf
,
sizeof
errbuf
,
&
erroffset
);
if
(
vre
==
NULL
)
{
VRT_fail
(
ctx
,
"vmod re: error compiling regex
\"
%s
\"
in %s "
"constructor: %s (at offset %d)"
,
pattern
,
vcl_name
,
errbuf
,
erroffset
);
return
;
}
ALLOC_OBJ
(
re
,
VMOD_RE_REGEX_MAGIC
);
AN
(
re
);
re
->
vre
=
vre
;
...
...
@@ -146,8 +137,6 @@ vmod_regex__fini(struct vmod_re_regex **rep)
re
=
*
rep
;
*
rep
=
NULL
;
CHECK_OBJ_NOTNULL
(
re
,
VMOD_RE_REGEX_MAGIC
);
if
(
re
->
vre
!=
NULL
)
VRE_free
(
&
re
->
vre
);
FREE_OBJ
(
re
);
}
...
...
src/vmod_re.vcc
View file @
0ee2f4ae
...
...
@@ -109,7 +109,7 @@ since it re-uses the compiled expression obtained at VCL
initialization. So if you are matching against a fixed pattern that
never changes during the lifetime of VCL, use ``match``.
$Object regex(
STRING
, INT limit=1000, INT limit_recursion=1000)
$Object regex(
REGEX
, INT limit=1000, INT limit_recursion=1000)
Description
Create a regex object with the given regular expression. The
...
...
Nils Goroll
@slink
mentioned in commit
685aa25e
·
Nov 01, 2021
mentioned in commit
685aa25e
mentioned in commit 685aa25ef98580635b4cef1d16875567e2cc45b5
Toggle commit list
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