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
52b51aa1
Commit
52b51aa1
authored
Sep 26, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Streamline VFP filter pushing
parent
c6ec0b49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
63 deletions
+50
-63
cache_busyobj.c
bin/varnishd/cache/cache_busyobj.c
+0
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+50
-57
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+0
-5
No files found.
bin/varnishd/cache/cache_busyobj.c
View file @
52b51aa1
...
...
@@ -38,7 +38,6 @@
#include "cache.h"
#include "hash/hash_slinger.h"
#include "cache/cache_filter.h"
static
struct
mempool
*
vbopool
;
...
...
bin/varnishd/cache/cache_fetch.c
View file @
52b51aa1
...
...
@@ -510,26 +510,9 @@ vbf_stp_fetchbody(struct worker *wrk, struct busyobj *bo)
/*--------------------------------------------------------------------
*/
#define vbf_vfp_push(bo, vfp) \
do { \
if (VFP_Push((bo)->vfc, (vfp)) == NULL) { \
(bo)->htc->doclose = SC_OVERLOAD; \
VDI_Finish((bo)->wrk, bo); \
return (F_STP_ERROR); \
} \
} while (0)
static
enum
fetch_step
vbf_stp_fetch
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
static
int
vbf_figure_out_vfp
(
struct
busyobj
*
bo
)
{
const
char
*
p
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
fetch_objcore
,
OBJCORE_MAGIC
);
assert
(
wrk
->
handling
==
VCL_RET_DELIVER
);
/*
* The VCL variables beresp.do_g[un]zip tells us how we want the
* object processed before it is stored.
...
...
@@ -543,60 +526,70 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
*
*/
/* We do nothing unless the param is set */
if
(
!
cache_param
->
http_gzip_support
)
bo
->
do_gzip
=
bo
->
do_gunzip
=
0
;
if
(
bo
->
htc
->
content_length
==
0
)
/* No body or no GZIP supprt -> done */
if
(
bo
->
htc
->
body_status
==
BS_NONE
||
bo
->
htc
->
content_length
==
0
||
!
cache_param
->
http_gzip_support
)
{
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
if
(
bo
->
htc
->
body_status
!=
BS_NONE
)
{
bo
->
is_gzip
=
http_HdrIs
(
bo
->
beresp
,
H_Content_Encoding
,
"gzip"
);
bo
->
is_gunzip
=
!
http_GetHdr
(
bo
->
beresp
,
H_Content_Encoding
,
NULL
);
assert
(
bo
->
is_gzip
==
0
||
bo
->
is_gunzip
==
0
);
bo
->
do_gzip
=
bo
->
do_gunzip
=
0
;
bo
->
do_stream
=
0
;
return
(
0
);
}
/* We won't gunzip unless it is non-empty and gzip'ed */
if
(
bo
->
htc
->
body_status
==
BS_NONE
||
bo
->
htc
->
content_length
==
0
||
(
bo
->
do_gunzip
&&
!
bo
->
is_gzip
))
bo
->
is_gzip
=
http_HdrIs
(
bo
->
beresp
,
H_Content_Encoding
,
"gzip"
);
bo
->
is_gunzip
=
!
http_GetHdr
(
bo
->
beresp
,
H_Content_Encoding
,
NULL
);
assert
(
bo
->
is_gzip
==
0
||
bo
->
is_gunzip
==
0
);
/* We won't gunzip unless it is gzip'ed */
if
(
bo
->
do_gunzip
&&
!
bo
->
is_gzip
)
bo
->
do_gunzip
=
0
;
/* We wont gzip unless it is non-empty and ungzip'ed */
if
(
bo
->
htc
->
body_status
==
BS_NONE
||
bo
->
htc
->
content_length
==
0
||
(
bo
->
do_gzip
&&
!
bo
->
is_gunzip
))
/* We wont gzip unless if it already is gzip'ed */
if
(
bo
->
do_gzip
&&
!
bo
->
is_gunzip
)
bo
->
do_gzip
=
0
;
/* But we can't do both at the same time */
assert
(
bo
->
do_gzip
==
0
||
bo
->
do_gunzip
==
0
);
if
(
bo
->
do_gunzip
||
(
bo
->
is_gzip
&&
bo
->
do_esi
))
vbf_vfp_push
(
bo
,
&
VFP_gunzip
);
if
(
bo
->
htc
->
content_length
!=
0
)
{
if
(
bo
->
do_esi
&&
bo
->
do_gzip
)
{
vbf_vfp_push
(
bo
,
&
VFP_esi_gzip
);
}
else
if
(
bo
->
do_esi
&&
bo
->
is_gzip
&&
!
bo
->
do_gunzip
)
{
vbf_vfp_push
(
bo
,
&
VFP_esi_gzip
);
}
else
if
(
bo
->
do_esi
)
{
vbf_vfp_push
(
bo
,
&
VFP_esi
);
}
else
if
(
bo
->
do_gzip
)
{
vbf_vfp_push
(
bo
,
&
VFP_gzip
);
}
else
if
(
bo
->
is_gzip
&&
!
bo
->
do_gunzip
)
{
vbf_vfp_push
(
bo
,
&
VFP_testgunzip
);
}
if
(
VFP_Push
(
bo
->
vfc
,
&
VFP_gunzip
)
==
NULL
)
return
(
-
1
);
if
(
bo
->
do_esi
&&
(
bo
->
do_gzip
||
(
bo
->
is_gzip
&&
!
bo
->
do_gunzip
)))
return
(
VFP_Push
(
bo
->
vfc
,
&
VFP_esi_gzip
)
==
NULL
?
-
1
:
0
);
if
(
bo
->
do_esi
)
return
(
VFP_Push
(
bo
->
vfc
,
&
VFP_esi
)
==
NULL
?
-
1
:
0
);
if
(
bo
->
do_gzip
)
return
(
VFP_Push
(
bo
->
vfc
,
&
VFP_gzip
)
==
NULL
?
-
1
:
0
);
if
(
bo
->
is_gzip
&&
!
bo
->
do_gunzip
)
return
(
VFP_Push
(
bo
->
vfc
,
&
VFP_testgunzip
)
==
NULL
?
-
1
:
0
);
return
(
0
);
}
static
enum
fetch_step
vbf_stp_fetch
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
const
char
*
p
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
fetch_objcore
,
OBJCORE_MAGIC
);
assert
(
wrk
->
handling
==
VCL_RET_DELIVER
);
if
(
vbf_figure_out_vfp
(
bo
))
{
(
bo
)
->
htc
->
doclose
=
SC_OVERLOAD
;
VDI_Finish
((
bo
)
->
wrk
,
bo
);
return
(
F_STP_ERROR
);
}
if
(
bo
->
fetch_objcore
->
flags
&
OC_F_PRIVATE
)
AN
(
bo
->
uncacheable
);
/* No reason to try streaming a non-existing body */
if
(
bo
->
htc
->
body_status
==
BS_NONE
)
bo
->
do_stream
=
0
;
bo
->
fetch_objcore
->
boc
->
len_so_far
=
0
;
if
(
VFP_Open
(
bo
->
vfc
))
{
...
...
bin/varnishd/cache/cache_gzip.c
View file @
52b51aa1
...
...
@@ -445,11 +445,6 @@ vfp_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
CHECK_OBJ_NOTNULL
(
vc
,
VFP_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vfe
,
VFP_ENTRY_MAGIC
);
if
(
http_HdrIs
(
vc
->
http
,
H_Content_Length
,
"0"
))
{
http_Unset
(
vc
->
http
,
H_Content_Encoding
);
return
(
VFP_NULL
);
}
if
(
vfe
->
vfp
==
&
VFP_gzip
)
{
if
(
http_GetHdr
(
vc
->
http
,
H_Content_Encoding
,
NULL
))
return
(
VFP_NULL
);
...
...
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