Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
9816a237
Commit
9816a237
authored
Sep 22, 2011
by
Poul-Henning Kamp
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
74f3c13e
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 @
9816a237
...
...
@@ -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 @
9816a237
...
...
@@ -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 @
9816a237
...
...
@@ -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