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
bced3f5b
Commit
bced3f5b
authored
Nov 01, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.varnish-cache.org/git/varnish-cache
parents
f6536dac
fe425ce6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
cache_vrt_re.c
bin/varnishd/cache_vrt_re.c
+8
-4
c00047.vtc
bin/varnishtest/tests/c00047.vtc
+33
-0
vre.h
include/vre.h
+1
-0
No files found.
bin/varnishd/cache_vrt_re.c
View file @
bced3f5b
...
...
@@ -90,13 +90,16 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
char
*
b0
;
const
char
*
s
;
unsigned
u
,
x
;
int
options
=
0
;
size_t
len
;
AN
(
re
);
if
(
str
==
NULL
)
str
=
""
;
t
=
re
;
memset
(
ovector
,
0
,
sizeof
(
ovector
));
i
=
VRE_exec
(
t
,
str
,
strlen
(
str
),
0
,
0
,
ovector
,
30
,
len
=
strlen
(
str
);
i
=
VRE_exec
(
t
,
str
,
len
,
0
,
options
,
ovector
,
30
,
&
params
->
vre_limits
);
/* If it didn't match, we can return the original string */
...
...
@@ -132,10 +135,12 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
}
}
str
+=
ovector
[
1
];
len
-=
ovector
[
1
];
if
(
!
all
)
break
;
memset
(
&
ovector
,
0
,
sizeof
(
ovector
));
i
=
VRE_exec
(
t
,
str
,
strlen
(
str
),
0
,
0
,
ovector
,
30
,
options
|=
VRE_NOTEMPTY_ATSTART
;
i
=
VRE_exec
(
t
,
str
,
len
,
0
,
options
,
ovector
,
30
,
&
params
->
vre_limits
);
if
(
i
<
VRE_ERROR_NOMATCH
)
{
WSP
(
sp
,
SLT_VCL_Error
,
...
...
@@ -145,8 +150,7 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
}
while
(
i
!=
VRE_ERROR_NOMATCH
);
/* Copy suffix to match */
l
=
strlen
(
str
)
+
1
;
Tadd
(
&
res
,
str
,
l
);
Tadd
(
&
res
,
str
,
len
+
1
);
if
(
res
.
b
>=
res
.
e
)
{
WS_Release
(
sp
->
http
->
ws
,
0
);
return
(
str
);
...
...
bin/varnishtest/tests/c00047.vtc
0 → 100644
View file @
bced3f5b
varnishtest "Test VCL regsuball()"
server s1 {
rxreq
txresp \
-hdr "foo: barbar" \
-hdr "bar: bbbar"
} -start
varnish v1 -vcl+backend {
sub vcl_fetch {
set beresp.http.baz1 = regsuball(beresp.http.foo, "barb", "zz");
set beresp.http.baz2 = regsuball(beresp.http.foo, "ar", "zz");
set beresp.http.baz3 = regsuball(beresp.http.foo, "^", "baz");
set beresp.http.baz4 = regsuball(beresp.http.foo, "^[;]*", "baz");
set beresp.http.baz5 = regsuball(beresp.http.bar, "^b*", "b");
set beresp.http.baz6 = regsuball(beresp.http.foo, "^b*", "z");
set beresp.http.baz7 = regsuball(beresp.http.foo, "ping", "pong");
}
} -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 200
expect resp.http.baz1 == "zzar"
expect resp.http.baz2 == "bzzbzz"
expect resp.http.baz3 == "bazbarbar"
expect resp.http.baz4 == "bazbarbar"
expect resp.http.baz5 == "bar"
expect resp.http.baz6 == "zarbar"
expect resp.http.baz7 == "barbar"
} -run
include/vre.h
View file @
bced3f5b
...
...
@@ -49,6 +49,7 @@ typedef struct vre vre_t;
/* And those to PCRE options */
#define VRE_CASELESS 0x00000001
#define VRE_NOTEMPTY_ATSTART 0x10000000
vre_t
*
VRE_compile
(
const
char
*
,
int
,
const
char
**
,
int
*
);
int
VRE_exec
(
const
vre_t
*
code
,
const
char
*
subject
,
int
length
,
...
...
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