Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
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
unique-xids
Commits
0d77e838
Commit
0d77e838
authored
Sep 22, 2011
by
Poul-Henning Kamp
Committed by
Tollef Fog Heen
Feb 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give VRT_re_match a sess* arg and report VRE errors using SLT_VCL_Error
instead of asserting. Inspired by: Patch from DocWilco
parent
a8e77732
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
cache_vrt_re.c
bin/varnishd/cache_vrt_re.c
+12
-2
vrt.h
include/vrt.h
+1
-1
vcc_expr.c
lib/libvcl/vcc_expr.c
+1
-1
No files found.
bin/varnishd/cache_vrt_re.c
View file @
0d77e838
...
...
@@ -67,7 +67,7 @@ VRT_re_fini(void *rep)
}
int
VRT_re_match
(
const
char
*
s
,
void
*
re
)
VRT_re_match
(
const
struct
sess
*
sp
,
const
char
*
s
,
void
*
re
)
{
vre_t
*
t
;
int
i
;
...
...
@@ -79,7 +79,8 @@ VRT_re_match(const char *s, void *re)
i
=
VRE_exec
(
t
,
s
,
strlen
(
s
),
0
,
0
,
NULL
,
0
);
if
(
i
>=
0
)
return
(
1
);
assert
(
i
==
VRE_ERROR_NOMATCH
);
if
(
i
<
VRE_ERROR_NOMATCH
)
WSP
(
sp
,
SLT_VCL_error
,
"Regexp matching returned %d"
,
i
);
return
(
0
);
}
...
...
@@ -105,6 +106,10 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
/* If it didn't match, we can return the original string */
if
(
i
==
VRE_ERROR_NOMATCH
)
return
(
str
);
if
(
i
<
VRE_ERROR_NOMATCH
)
{
WSP
(
sp
,
SLT_VCL_error
,
"Regexp matching returned %d"
,
i
);
return
(
str
);
}
u
=
WS_Reserve
(
sp
->
http
->
ws
,
0
);
res
.
e
=
res
.
b
=
b0
=
sp
->
http
->
ws
->
f
;
...
...
@@ -135,6 +140,11 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
break
;
memset
(
&
ovector
,
0
,
sizeof
(
ovector
));
i
=
VRE_exec
(
t
,
str
,
strlen
(
str
),
0
,
0
,
ovector
,
30
);
if
(
i
<
VRE_ERROR_NOMATCH
)
{
WSP
(
sp
,
SLT_VCL_error
,
"Regexp matching returned %d"
,
i
);
return
(
str
);
}
}
while
(
i
!=
VRE_ERROR_NOMATCH
);
/* Copy suffix to match */
...
...
include/vrt.h
View file @
0d77e838
...
...
@@ -145,7 +145,7 @@ void VRT_acl_log(const struct sess *, const char *msg);
/* Regexp related */
void
VRT_re_init
(
void
**
,
const
char
*
);
void
VRT_re_fini
(
void
*
);
int
VRT_re_match
(
const
char
*
,
void
*
re
);
int
VRT_re_match
(
const
struct
sess
*
sp
,
const
char
*
,
void
*
re
);
const
char
*
VRT_regsub
(
const
struct
sess
*
sp
,
int
all
,
const
char
*
,
void
*
,
const
char
*
);
...
...
lib/libvcl/vcc_expr.c
View file @
0d77e838
...
...
@@ -941,7 +941,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
re
=
vcc_regexp
(
tl
);
ERRCHK
(
tl
);
vcc_NextToken
(
tl
);
bprintf
(
buf
,
"%sVRT_re_match(
\v
1, %s)"
,
not
,
re
);
bprintf
(
buf
,
"%sVRT_re_match(
sp,
\v
1, %s)"
,
not
,
re
);
*
e
=
vcc_expr_edit
(
BOOL
,
buf
,
*
e
,
NULL
);
return
;
}
...
...
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