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
62c75f7d
Commit
62c75f7d
authored
Oct 11, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start registering VDPs
parent
3f533abb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
24 deletions
+86
-24
cache_filter.h
bin/varnishd/cache/cache_filter.h
+2
-0
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+3
-0
cache_vcl.h
bin/varnishd/cache/cache_vcl.h
+4
-3
cache_vrt_filter.c
bin/varnishd/cache/cache_vrt_filter.c
+77
-21
No files found.
bin/varnishd/cache/cache_filter.h
View file @
62c75f7d
...
@@ -130,3 +130,5 @@ struct vdp_ctx {
...
@@ -130,3 +130,5 @@ struct vdp_ctx {
int
VDP_bytes
(
struct
req
*
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
);
int
VDP_bytes
(
struct
req
*
,
enum
vdp_action
act
,
const
void
*
ptr
,
ssize_t
len
);
int
VDP_push
(
struct
req
*
,
const
struct
vdp
*
,
void
*
priv
,
int
bottom
);
int
VDP_push
(
struct
req
*
,
const
struct
vdp
*
,
void
*
priv
,
int
bottom
);
void
VRT_AddVDP
(
VRT_CTX
,
const
struct
vdp
*
);
void
VRT_RemoveVDP
(
VRT_CTX
,
const
struct
vdp
*
);
bin/varnishd/cache/cache_vcl.c
View file @
62c75f7d
...
@@ -408,6 +408,8 @@ VCL_Close(struct vcl **vclp)
...
@@ -408,6 +408,8 @@ VCL_Close(struct vcl **vclp)
CHECK_OBJ_NOTNULL
(
*
vclp
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
*
vclp
,
VCL_MAGIC
);
vcl
=
*
vclp
;
vcl
=
*
vclp
;
*
vclp
=
NULL
;
*
vclp
=
NULL
;
assert
(
VTAILQ_EMPTY
(
&
vcl
->
vfps
));
assert
(
VTAILQ_EMPTY
(
&
vcl
->
vdps
));
AZ
(
dlclose
(
vcl
->
dlh
));
AZ
(
dlclose
(
vcl
->
dlh
));
AZ
(
errno
=
pthread_rwlock_destroy
(
&
vcl
->
temp_rwl
));
AZ
(
errno
=
pthread_rwlock_destroy
(
&
vcl
->
temp_rwl
));
FREE_OBJ
(
vcl
);
FREE_OBJ
(
vcl
);
...
@@ -565,6 +567,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
...
@@ -565,6 +567,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
VTAILQ_INIT
(
&
vcl
->
director_list
);
VTAILQ_INIT
(
&
vcl
->
director_list
);
VTAILQ_INIT
(
&
vcl
->
ref_list
);
VTAILQ_INIT
(
&
vcl
->
ref_list
);
VTAILQ_INIT
(
&
vcl
->
vfps
);
VTAILQ_INIT
(
&
vcl
->
vfps
);
VTAILQ_INIT
(
&
vcl
->
vdps
);
vcl
->
temp
=
VCL_TEMP_INIT
;
vcl
->
temp
=
VCL_TEMP_INIT
;
...
...
bin/varnishd/cache/cache_vcl.h
View file @
62c75f7d
...
@@ -31,9 +31,9 @@
...
@@ -31,9 +31,9 @@
*
*
*/
*/
struct
vf
p_f
ilter
;
struct
vfilter
;
VTAILQ_HEAD
(
vf
p_filter_head
,
vfp_
filter
);
VTAILQ_HEAD
(
vf
ilter_head
,
v
filter
);
struct
vcl
{
struct
vcl
{
...
@@ -53,7 +53,8 @@ struct vcl {
...
@@ -53,7 +53,8 @@ struct vcl {
int
nrefs
;
int
nrefs
;
struct
vcl
*
label
;
struct
vcl
*
label
;
int
nlabels
;
int
nlabels
;
struct
vfp_filter_head
vfps
;
struct
vfilter_head
vfps
;
struct
vfilter_head
vdps
;
};
};
struct
vclref
{
struct
vclref
{
...
...
bin/varnishd/cache/cache_vrt_filter.c
View file @
62c75f7d
...
@@ -46,49 +46,103 @@
...
@@ -46,49 +46,103 @@
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
*/
*/
struct
vf
p_f
ilter
{
struct
vfilter
{
unsigned
magic
;
unsigned
magic
;
#define VFP_FILTER_MAGIC 0xd40894e9
#define VFILTER_MAGIC 0xd40894e9
const
struct
vfp
*
filter
;
const
struct
vfp
*
vfp
;
const
struct
vdp
*
vdp
;
const
char
*
name
;
int
nlen
;
int
nlen
;
VTAILQ_ENTRY
(
vf
p_filter
)
list
;
VTAILQ_ENTRY
(
vf
ilter
)
list
;
};
};
static
struct
vf
p_f
ilter_head
vfp_filters
=
static
struct
vfilter_head
vfp_filters
=
VTAILQ_HEAD_INITIALIZER
(
vfp_filters
);
VTAILQ_HEAD_INITIALIZER
(
vfp_filters
);
static
struct
vfilter_head
vdp_filters
=
VTAILQ_HEAD_INITIALIZER
(
vdp_filters
);
void
void
VRT_AddVFP
(
VRT_CTX
,
const
struct
vfp
*
filter
)
VRT_AddVFP
(
VRT_CTX
,
const
struct
vfp
*
filter
)
{
{
struct
vf
p_f
ilter
*
vp
;
struct
vfilter
*
vp
;
struct
vf
p_f
ilter_head
*
hd
=
&
vfp_filters
;
struct
vfilter_head
*
hd
=
&
vfp_filters
;
CHECK_OBJ_ORNULL
(
ctx
,
VRT_CTX_MAGIC
);
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
xxxassert
(
vp
->
filter
!=
filter
);
xxxassert
(
vp
->
vfp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
filter
->
name
,
filter
->
name
));
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
}
if
(
ctx
!=
NULL
)
{
if
(
ctx
!=
NULL
)
{
ASSERT_CLI
();
hd
=
&
ctx
->
vcl
->
vfps
;
hd
=
&
ctx
->
vcl
->
vfps
;
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
xxxassert
(
vp
->
filter
!=
filter
);
xxxassert
(
vp
->
vfp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
filter
->
name
,
filter
->
name
));
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
}
ALLOC_OBJ
(
vp
,
VFILTER_MAGIC
);
AN
(
vp
);
vp
->
vfp
=
filter
;
vp
->
name
=
filter
->
name
;
vp
->
nlen
=
strlen
(
vp
->
name
);
VTAILQ_INSERT_TAIL
(
hd
,
vp
,
list
);
}
void
VRT_AddVDP
(
VRT_CTX
,
const
struct
vdp
*
filter
)
{
struct
vfilter
*
vp
;
struct
vfilter_head
*
hd
=
&
vdp_filters
;
CHECK_OBJ_ORNULL
(
ctx
,
VRT_CTX_MAGIC
);
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
xxxassert
(
vp
->
vdp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
if
(
ctx
!=
NULL
)
{
ASSERT_CLI
();
hd
=
&
ctx
->
vcl
->
vdps
;
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
xxxassert
(
vp
->
vdp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
}
}
}
ALLOC_OBJ
(
vp
,
VF
P_F
ILTER_MAGIC
);
ALLOC_OBJ
(
vp
,
VFILTER_MAGIC
);
AN
(
vp
);
AN
(
vp
);
vp
->
filter
=
filter
;
vp
->
vdp
=
filter
;
vp
->
nlen
=
strlen
(
filter
->
name
);
vp
->
name
=
filter
->
name
;
vp
->
nlen
=
strlen
(
vp
->
name
);
VTAILQ_INSERT_TAIL
(
hd
,
vp
,
list
);
VTAILQ_INSERT_TAIL
(
hd
,
vp
,
list
);
}
}
void
void
VRT_RemoveVFP
(
VRT_CTX
,
const
struct
vfp
*
filter
)
VRT_RemoveVFP
(
VRT_CTX
,
const
struct
vfp
*
filter
)
{
{
struct
vf
p_f
ilter
*
vp
;
struct
vfilter
*
vp
;
struct
vf
p_f
ilter_head
*
hd
=
&
ctx
->
vcl
->
vfps
;
struct
vfilter_head
*
hd
=
&
ctx
->
vcl
->
vfps
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
ASSERT_CLI
();
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
if
(
vp
->
vfp
==
filter
)
break
;
}
XXXAN
(
vp
);
VTAILQ_REMOVE
(
hd
,
vp
,
list
);
FREE_OBJ
(
vp
);
}
void
VRT_RemoveVDP
(
VRT_CTX
,
const
struct
vdp
*
filter
)
{
struct
vfilter
*
vp
;
struct
vfilter_head
*
hd
=
&
ctx
->
vcl
->
vdps
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
ASSERT_CLI
();
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
if
(
vp
->
filter
==
filter
)
if
(
vp
->
vdp
==
filter
)
break
;
break
;
}
}
XXXAN
(
vp
);
XXXAN
(
vp
);
...
@@ -100,7 +154,7 @@ int
...
@@ -100,7 +154,7 @@ int
VCL_StackVFP
(
struct
vfp_ctx
*
vc
,
const
struct
vcl
*
vcl
,
const
char
*
fl
)
VCL_StackVFP
(
struct
vfp_ctx
*
vc
,
const
struct
vcl
*
vcl
,
const
char
*
fl
)
{
{
const
char
*
p
,
*
q
;
const
char
*
p
,
*
q
;
const
struct
vf
p_f
ilter
*
vp
;
const
struct
vfilter
*
vp
;
VSLb
(
vc
->
wrk
->
vsl
,
SLT_Filters
,
"%s"
,
fl
);
VSLb
(
vc
->
wrk
->
vsl
,
SLT_Filters
,
"%s"
,
fl
);
...
@@ -115,21 +169,21 @@ VCL_StackVFP(struct vfp_ctx *vc, const struct vcl *vcl, const char *fl)
...
@@ -115,21 +169,21 @@ VCL_StackVFP(struct vfp_ctx *vc, const struct vcl *vcl, const char *fl)
VTAILQ_FOREACH
(
vp
,
&
vfp_filters
,
list
)
{
VTAILQ_FOREACH
(
vp
,
&
vfp_filters
,
list
)
{
if
(
vp
->
nlen
!=
q
-
p
)
if
(
vp
->
nlen
!=
q
-
p
)
continue
;
continue
;
if
(
!
memcmp
(
p
,
vp
->
filter
->
name
,
vp
->
nlen
))
if
(
!
memcmp
(
p
,
vp
->
name
,
vp
->
nlen
))
break
;
break
;
}
}
if
(
vp
==
NULL
)
{
if
(
vp
==
NULL
)
{
VTAILQ_FOREACH
(
vp
,
&
vcl
->
vfps
,
list
)
{
VTAILQ_FOREACH
(
vp
,
&
vcl
->
vfps
,
list
)
{
if
(
vp
->
nlen
!=
q
-
p
)
if
(
vp
->
nlen
!=
q
-
p
)
continue
;
continue
;
if
(
!
memcmp
(
p
,
vp
->
filter
->
name
,
vp
->
nlen
))
if
(
!
memcmp
(
p
,
vp
->
name
,
vp
->
nlen
))
break
;
break
;
}
}
}
}
if
(
vp
==
NULL
)
if
(
vp
==
NULL
)
return
(
VFP_Error
(
vc
,
return
(
VFP_Error
(
vc
,
"Filter '%.*s' not found"
,
(
int
)(
q
-
p
),
p
));
"Filter '%.*s' not found"
,
(
int
)(
q
-
p
),
p
));
if
(
VFP_Push
(
vc
,
vp
->
filter
)
==
NULL
)
if
(
VFP_Push
(
vc
,
vp
->
vfp
)
==
NULL
)
return
(
-
1
);
return
(
-
1
);
}
}
return
(
0
);
return
(
0
);
...
@@ -143,6 +197,8 @@ VCL_VRT_Init(void)
...
@@ -143,6 +197,8 @@ VCL_VRT_Init(void)
VRT_AddVFP
(
NULL
,
&
VFP_gzip
);
VRT_AddVFP
(
NULL
,
&
VFP_gzip
);
VRT_AddVFP
(
NULL
,
&
VFP_esi
);
VRT_AddVFP
(
NULL
,
&
VFP_esi
);
VRT_AddVFP
(
NULL
,
&
VFP_esi_gzip
);
VRT_AddVFP
(
NULL
,
&
VFP_esi_gzip
);
VRT_AddVDP
(
NULL
,
&
VDP_esi
);
VRT_AddVDP
(
NULL
,
&
VDP_gunzip
);
}
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
...
...
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