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
765139fa
Commit
765139fa
authored
Apr 16, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove more 'req' arguments from VRT
parent
8641ba85
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
46 deletions
+28
-46
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+2
-38
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+1
-1
vrt.h
include/vrt.h
+1
-2
generate.py
lib/libvcl/generate.py
+23
-4
vcc_action.c
lib/libvcl/vcc_action.c
+1
-1
No files found.
bin/varnishd/cache/cache_vrt.c
View file @
765139fa
...
...
@@ -293,10 +293,9 @@ VRT_hashdata(struct req *req, const char *str, ...)
/*--------------------------------------------------------------------*/
double
VRT_r_now
(
const
struct
req
*
req
)
VRT_r_now
()
{
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
return
(
VTIM_real
());
}
...
...
@@ -430,41 +429,7 @@ VRT_synth_page(const struct req *req, unsigned flags, const char *str, ...)
/*--------------------------------------------------------------------*/
void
VRT_ban
(
const
struct
req
*
req
,
char
*
cmds
,
...)
{
char
*
a1
,
*
a2
,
*
a3
;
va_list
ap
;
struct
ban
*
b
;
int
good
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
b
=
BAN_New
();
va_start
(
ap
,
cmds
);
a1
=
cmds
;
good
=
0
;
while
(
a1
!=
NULL
)
{
good
=
0
;
a2
=
va_arg
(
ap
,
char
*
);
if
(
a2
==
NULL
)
break
;
a3
=
va_arg
(
ap
,
char
*
);
if
(
a3
==
NULL
)
break
;
if
(
BAN_AddTest
(
NULL
,
b
,
a1
,
a2
,
a3
))
break
;
a1
=
va_arg
(
ap
,
char
*
);
good
=
1
;
}
if
(
!
good
)
BAN_Free
(
b
);
/* XXX: report error how ? */
else
(
void
)
BAN_Insert
(
b
);
/* XXX: report error how ? */
}
/*--------------------------------------------------------------------*/
void
VRT_ban_string
(
const
struct
req
*
req
,
const
char
*
str
)
VRT_ban_string
(
const
char
*
str
)
{
char
*
a1
,
*
a2
,
*
a3
;
char
**
av
;
...
...
@@ -472,7 +437,6 @@ VRT_ban_string(const struct req *req, const char *str)
int
good
;
int
i
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
av
=
VAV_Parse
(
str
,
NULL
,
ARGV_NOESC
);
if
(
av
[
0
]
!=
NULL
)
{
/* XXX: report error how ? */
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
765139fa
...
...
@@ -232,7 +232,7 @@ VRT_l_client_identity(struct req *req, const char *str, ...)
/*--------------------------------------------------------------------*/
#define BEREQ_TIMEOUT(which) \
void
\
void \
VRT_l_bereq_##which(const struct req *req, double num) \
{ \
\
...
...
include/vrt.h
View file @
765139fa
...
...
@@ -168,8 +168,7 @@ int VRT_re_match(struct req *, const char *, void *re);
const
char
*
VRT_regsub
(
struct
req
*
,
int
all
,
const
char
*
,
void
*
,
const
char
*
);
void
VRT_ban
(
const
struct
req
*
,
char
*
,
...);
void
VRT_ban_string
(
const
struct
req
*
,
const
char
*
);
void
VRT_ban_string
(
const
char
*
);
void
VRT_purge
(
struct
req
*
,
double
ttl
,
double
grace
);
void
VRT_count
(
struct
req
*
,
unsigned
);
...
...
lib/libvcl/generate.py
View file @
765139fa
...
...
@@ -481,7 +481,7 @@ sp_variables = (
'TIME'
,
(
'all'
,),
(
),
'
cR
'
''
),
)
...
...
@@ -851,6 +851,8 @@ const struct var vcc_vars[] = {
"""
)
def
mk_proto
(
c
,
r
=
False
):
if
c
==
""
:
return
"void"
s
=
""
for
i
in
c
:
if
i
==
"c"
and
not
r
:
...
...
@@ -861,6 +863,20 @@ def mk_proto(c, r=False):
s
+=
" struct req *"
return
s
[
1
:]
def
mk_args
(
c
,
r
=
False
):
if
c
==
""
:
return
""
s
=
""
for
i
in
c
:
if
i
==
"c"
:
continue
;
if
i
==
"R"
:
s
+=
"req"
if
s
!=
""
and
not
r
:
s
+=
","
return
s
for
i
in
sp_variables
:
typ
=
i
[
1
]
cnam
=
i
[
0
]
.
replace
(
"."
,
"_"
)
...
...
@@ -875,8 +891,10 @@ for i in sp_variables:
fo
.
write
(
i
[
0
]
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
'",
\n
'
)
else
:
fo
.
write
(
'
\t
"VRT_r_
%
s(req)",
\n
'
%
cnam
)
fh
.
write
(
ctyp
+
" VRT_r_
%
s(
%
s);
\n
"
%
(
cnam
,
mk_proto
(
i
[
4
],
True
)))
fo
.
write
(
'
\t
"VRT_r_
%
s(
%
s)",
\n
'
%
(
cnam
,
mk_args
(
i
[
4
],
True
)))
fh
.
write
(
ctyp
+
" VRT_r_
%
s(
%
s);
\n
"
%
(
cnam
,
mk_proto
(
i
[
4
],
True
)))
restrict
(
fo
,
i
[
2
])
if
len
(
i
[
3
])
==
0
:
...
...
@@ -886,7 +904,8 @@ for i in sp_variables:
fo
.
write
(
i
[
0
]
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
'",
\n
'
)
else
:
fo
.
write
(
'
\t
"VRT_l_
%
s(req, ",
\n
'
%
cnam
)
fo
.
write
(
'
\t
"VRT_l_
%
s(
%
s",
\n
'
%
(
cnam
,
mk_args
(
i
[
4
],
False
)))
fh
.
write
(
"void VRT_l_
%
s(
%
s, "
%
(
cnam
,
mk_proto
(
i
[
4
],
False
)))
if
typ
!=
"STRING"
:
fh
.
write
(
ctyp
+
");
\n
"
)
...
...
lib/libvcl/vcc_action.c
View file @
765139fa
...
...
@@ -261,7 +261,7 @@ parse_ban(struct vcc *tl)
ExpectErr
(
tl
,
'('
);
vcc_NextToken
(
tl
);
Fb
(
tl
,
1
,
"VRT_ban_string(
req,
"
);
Fb
(
tl
,
1
,
"VRT_ban_string("
);
vcc_Expr
(
tl
,
STRING
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
");
\n
"
);
...
...
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