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
25228a23
Commit
25228a23
authored
May 16, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VCL regexp and regsub should treat a NULL argument as an empty
string. Fixes #913
parent
7ff31e98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
cache_vrt_re.c
bin/varnishd/cache_vrt_re.c
+2
-2
r00913.vtc
bin/varnishtest/tests/r00913.vtc
+22
-0
No files found.
bin/varnishd/cache_vrt_re.c
View file @
25228a23
...
...
@@ -70,7 +70,7 @@ VRT_re_match(const char *s, void *re)
int
i
;
if
(
s
==
NULL
)
return
(
0
)
;
s
=
""
;
AN
(
re
);
t
=
re
;
i
=
VRE_exec
(
t
,
s
,
strlen
(
s
),
0
,
0
,
NULL
,
0
);
...
...
@@ -94,7 +94,7 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
AN
(
re
);
if
(
str
==
NULL
)
return
(
""
)
;
str
=
""
;
t
=
re
;
memset
(
ovector
,
0
,
sizeof
(
ovector
));
i
=
VRE_exec
(
t
,
str
,
strlen
(
str
),
0
,
0
,
ovector
,
30
);
...
...
bin/varnishtest/tests/r00913.vtc
0 → 100644
View file @
25228a23
varnishtest "test regsub(NULL)"
server s1 {
rxreq
expect req.url == "/bar"
txresp -body "foobar"
} -start
varnish v1 -vcl+backend {
sub vcl_fetch {
if (beresp.http.bar ~ "$") {
set beresp.http.foo = regsub(beresp.http.bar, "$", "XXX");
}
}
} -start
client c1 {
txreq -url /bar
rxresp
expect resp.http.content-length == 6
expect resp.http.foo == "XXX"
} -run
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