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
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
Show 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)
...
@@ -67,7 +67,7 @@ VRT_re_fini(void *rep)
}
}
int
int
VRT_re_match
(
const
char
*
s
,
void
*
re
)
VRT_re_match
(
const
struct
sess
*
sp
,
const
char
*
s
,
void
*
re
)
{
{
vre_t
*
t
;
vre_t
*
t
;
int
i
;
int
i
;
...
@@ -79,7 +79,8 @@ VRT_re_match(const char *s, void *re)
...
@@ -79,7 +79,8 @@ VRT_re_match(const char *s, void *re)
i
=
VRE_exec
(
t
,
s
,
strlen
(
s
),
0
,
0
,
NULL
,
0
);
i
=
VRE_exec
(
t
,
s
,
strlen
(
s
),
0
,
0
,
NULL
,
0
);
if
(
i
>=
0
)
if
(
i
>=
0
)
return
(
1
);
return
(
1
);
assert
(
i
==
VRE_ERROR_NOMATCH
);
if
(
i
<
VRE_ERROR_NOMATCH
)
WSP
(
sp
,
SLT_VCL_error
,
"Regexp matching returned %d"
,
i
);
return
(
0
);
return
(
0
);
}
}
...
@@ -105,6 +106,10 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
...
@@ -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 it didn't match, we can return the original string */
if
(
i
==
VRE_ERROR_NOMATCH
)
if
(
i
==
VRE_ERROR_NOMATCH
)
return
(
str
);
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
);
u
=
WS_Reserve
(
sp
->
http
->
ws
,
0
);
res
.
e
=
res
.
b
=
b0
=
sp
->
http
->
ws
->
f
;
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,
...
@@ -135,6 +140,11 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
break
;
break
;
memset
(
&
ovector
,
0
,
sizeof
(
ovector
));
memset
(
&
ovector
,
0
,
sizeof
(
ovector
));
i
=
VRE_exec
(
t
,
str
,
strlen
(
str
),
0
,
0
,
ovector
,
30
);
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
);
}
while
(
i
!=
VRE_ERROR_NOMATCH
);
/* Copy suffix to match */
/* Copy suffix to match */
...
...
include/vrt.h
View file @
0d77e838
...
@@ -145,7 +145,7 @@ void VRT_acl_log(const struct sess *, const char *msg);
...
@@ -145,7 +145,7 @@ void VRT_acl_log(const struct sess *, const char *msg);
/* Regexp related */
/* Regexp related */
void
VRT_re_init
(
void
**
,
const
char
*
);
void
VRT_re_init
(
void
**
,
const
char
*
);
void
VRT_re_fini
(
void
*
);
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
*
,
const
char
*
VRT_regsub
(
const
struct
sess
*
sp
,
int
all
,
const
char
*
,
void
*
,
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)
...
@@ -941,7 +941,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
re
=
vcc_regexp
(
tl
);
re
=
vcc_regexp
(
tl
);
ERRCHK
(
tl
);
ERRCHK
(
tl
);
vcc_NextToken
(
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
);
*
e
=
vcc_expr_edit
(
BOOL
,
buf
,
*
e
,
NULL
);
return
;
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