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
6eb3f1eb
Commit
6eb3f1eb
authored
May 14, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the magic gzip bit positions whenever we spot them changing.
parent
3bd29b4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
cache.h
bin/varnishd/cache/cache.h
+8
-1
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+2
-1
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+14
-5
No files found.
bin/varnishd/cache/cache.h
View file @
6eb3f1eb
...
...
@@ -822,7 +822,14 @@ enum vgzret_e VGZ_Gzip(struct vgz *, const void **, ssize_t *len,
enum
vgz_flag
);
// enum vgzret_e VGZ_Gunzip(struct vgz *, const void **, ssize_t *len);
enum
vgzret_e
VGZ_Destroy
(
struct
vgz
**
);
void
VGZ_UpdateObj
(
const
struct
vfp_ctx
*
,
const
struct
vgz
*
,
int
input
);
enum
vgz_ua_e
{
VUA_UPDATE
,
// Update start/stop/last bits if changed
VUA_END_GZIP
,
// Record uncompressed size
VUA_END_GUNZIP
,
// Record uncompressed size
};
void
VGZ_UpdateObj
(
const
struct
vfp_ctx
*
,
struct
vgz
*
,
enum
vgz_ua_e
);
/* cache_http.c */
unsigned
HTTP_estimate
(
unsigned
nhttp
);
...
...
bin/varnishd/cache/cache_esi_fetch.c
View file @
6eb3f1eb
...
...
@@ -94,6 +94,7 @@ vfp_vep_callback(struct vfp_ctx *vc, void *priv, ssize_t l, enum vgz_flag flg)
}
VGZ_Obuf
(
vef
->
vgz
,
ptr
,
dl
);
i
=
VGZ_Gzip
(
vef
->
vgz
,
&
dp
,
&
dl
,
flg
);
VGZ_UpdateObj
(
vc
,
vef
->
vgz
,
VUA_UPDATE
);
vef
->
tot
+=
dl
;
VBO_extend
(
vc
->
bo
,
dl
);
}
while
(
i
!=
VGZ_ERROR
&&
...
...
@@ -131,7 +132,7 @@ vfp_esi_end(struct vfp_ctx *vc, struct vef_priv *vef,
}
if
(
vef
->
vgz
!=
NULL
)
{
VGZ_UpdateObj
(
vc
,
vef
->
vgz
,
1
);
VGZ_UpdateObj
(
vc
,
vef
->
vgz
,
VUA_END_GZIP
);
if
(
VGZ_Destroy
(
&
vef
->
vgz
)
!=
VGZ_END
)
retval
=
VFP_Error
(
vc
,
"ESI+Gzip Failed at the very end"
);
...
...
bin/varnishd/cache/cache_gzip.c
View file @
6eb3f1eb
...
...
@@ -59,6 +59,8 @@ struct vgz {
ssize_t
m_sz
;
ssize_t
m_len
;
intmax_t
bits
;
z_stream
vz
;
};
...
...
@@ -348,19 +350,24 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv,
/*--------------------------------------------------------------------*/
void
VGZ_UpdateObj
(
const
struct
vfp_ctx
*
vc
,
const
struct
vgz
*
vg
,
int
input
)
VGZ_UpdateObj
(
const
struct
vfp_ctx
*
vc
,
struct
vgz
*
vg
,
enum
vgz_ua_e
e
)
{
char
*
p
;
intmax_t
ii
;
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
ii
=
vg
->
vz
.
start_bit
+
vg
->
vz
.
last_bit
+
vg
->
vz
.
stop_bit
;
if
(
e
==
VUA_UPDATE
&&
ii
==
vg
->
bits
)
return
;
vg
->
bits
=
ii
;
p
=
ObjSetattr
(
vc
->
wrk
,
vc
->
oc
,
OA_GZIPBITS
,
32
,
NULL
);
AN
(
p
);
vbe64enc
(
p
,
vg
->
vz
.
start_bit
);
vbe64enc
(
p
+
8
,
vg
->
vz
.
last_bit
);
vbe64enc
(
p
+
16
,
vg
->
vz
.
stop_bit
);
if
(
input
)
if
(
e
==
VUA_END_GZIP
)
vbe64enc
(
p
+
24
,
vg
->
vz
.
total_in
);
else
if
(
e
==
VUA_END_GUNZIP
)
vbe64enc
(
p
+
24
,
vg
->
vz
.
total_out
);
}
...
...
@@ -553,6 +560,7 @@ vfp_gzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p,
if
(
vr
<
VGZ_OK
)
return
(
VFP_Error
(
vc
,
"Gzip failed"
));
if
(
dl
>
0
)
{
VGZ_UpdateObj
(
vc
,
vg
,
VUA_UPDATE
);
*
lp
=
dl
;
assert
(
dp
==
p
);
return
(
VFP_OK
);
...
...
@@ -563,7 +571,7 @@ vfp_gzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p,
if
(
vr
!=
VGZ_END
)
return
(
VFP_Error
(
vc
,
"Gzip failed"
));
VGZ_UpdateObj
(
vc
,
vg
,
1
);
VGZ_UpdateObj
(
vc
,
vg
,
VUA_END_GZIP
);
return
(
VFP_END
);
}
...
...
@@ -605,10 +613,11 @@ vfp_testgunzip_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *p,
"Invalid Gzip data: %s"
,
vg
->
vz
.
msg
));
}
while
(
!
VGZ_IbufEmpty
(
vg
));
}
VGZ_UpdateObj
(
vc
,
vg
,
VUA_UPDATE
);
if
(
vp
==
VFP_END
)
{
if
(
vr
!=
VGZ_END
)
return
(
VFP_Error
(
vc
,
"tGunzip failed"
));
VGZ_UpdateObj
(
vc
,
vg
,
0
);
VGZ_UpdateObj
(
vc
,
vg
,
VUA_END_GUNZIP
);
}
return
(
vp
);
}
...
...
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