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
336e375c
Commit
336e375c
authored
Oct 30, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse the "turn WS into VSB" code.
parent
78325c4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
27 deletions
+57
-27
cache_vrt_filter.c
bin/varnishd/cache/cache_vrt_filter.c
+57
-27
No files found.
bin/varnishd/cache/cache_vrt_filter.c
View file @
336e375c
...
...
@@ -219,13 +219,51 @@ VCL_VRT_Init(void)
/*--------------------------------------------------------------------
*/
static
void
vbf_default_filter_list
(
const
struct
busyobj
*
bo
,
struct
vsb
*
vsb
)
typedef
void
filter_list_t
(
const
void
*
,
struct
vsb
*
vsb
);
static
const
char
*
filter_on_ws
(
struct
ws
*
ws
,
filter_list_t
*
func
,
const
void
*
arg
)
{
unsigned
u
;
struct
vsb
vsb
[
1
];
AN
(
func
);
AN
(
arg
);
u
=
WS_Reserve
(
ws
,
0
);
if
(
u
==
0
)
{
WS_Release
(
ws
,
0
);
WS_MarkOverflow
(
ws
);
return
(
NULL
);
}
AN
(
VSB_new
(
vsb
,
ws
->
f
,
u
,
VSB_FIXEDLEN
));
func
(
arg
,
vsb
);
if
(
VSB_finish
(
vsb
))
{
WS_Release
(
ws
,
0
);
WS_MarkOverflow
(
ws
);
return
(
NULL
);
}
if
(
VSB_len
(
vsb
))
{
WS_Release
(
ws
,
VSB_len
(
vsb
)
+
1
);
return
(
VSB_data
(
vsb
)
+
1
);
}
WS_Release
(
ws
,
0
);
return
(
""
);
}
/*--------------------------------------------------------------------
*/
static
void
v_matchproto_
(
filter_list_t
)
vbf_default_filter_list
(
const
void
*
arg
,
struct
vsb
*
vsb
)
{
const
struct
busyobj
*
bo
;
const
char
*
p
;
int
do_gzip
=
bo
->
do_gzip
;
int
do_gunzip
=
bo
->
do_gunzip
;
int
is_gzip
=
0
,
is_gunzip
=
0
;
int
do_gzip
,
do_gunzip
,
is_gzip
=
0
,
is_gunzip
=
0
;
CAST_OBJ_NOTNULL
(
bo
,
arg
,
BUSYOBJ_MAGIC
);
do_gzip
=
bo
->
do_gzip
;
do_gunzip
=
bo
->
do_gunzip
;
/*
* The VCL variables beresp.do_g[un]zip tells us how we want the
...
...
@@ -282,36 +320,28 @@ vbf_default_filter_list(const struct busyobj *bo, struct vsb *vsb)
const
char
*
VBF_Get_Filter_List
(
struct
busyobj
*
bo
)
{
unsigned
u
;
struct
vsb
vsb
[
1
];
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
u
=
WS_Reserve
(
bo
->
ws
,
0
);
if
(
u
==
0
)
{
WS_Release
(
bo
->
ws
,
0
);
WS_MarkOverflow
(
bo
->
ws
);
return
(
NULL
);
}
AN
(
VSB_new
(
vsb
,
bo
->
ws
->
f
,
u
,
VSB_FIXEDLEN
));
vbf_default_filter_list
(
bo
,
vsb
);
if
(
VSB_finish
(
vsb
))
{
WS_Release
(
bo
->
ws
,
0
);
WS_MarkOverflow
(
bo
->
ws
);
return
(
NULL
);
}
if
(
VSB_len
(
vsb
))
{
WS_Release
(
bo
->
ws
,
VSB_len
(
vsb
)
+
1
);
return
(
VSB_data
(
vsb
)
+
1
);
}
WS_Release
(
bo
->
ws
,
0
);
return
(
""
);
return
(
filter_on_ws
(
bo
->
ws
,
vbf_default_filter_list
,
bo
));
}
/*--------------------------------------------------------------------
*/
static
void
v_matchproto_
(
filter_list_t
)
resp_default_filter_list
(
const
void
*
arg
,
struct
vsb
*
vsb
)
{
const
struct
req
*
req
;
CAST_OBJ_NOTNULL
(
req
,
arg
,
REQ_MAGIC
);
(
void
)
vsb
;
}
static
const
char
*
resp_Get_Filter_List
(
struct
req
*
req
)
{
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
return
(
""
);
return
(
filter_on_ws
(
req
->
ws
,
resp_default_filter_list
,
req
)
);
}
/*--------------------------------------------------------------------*/
...
...
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