Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
ab76cb9a
Commit
ab76cb9a
authored
Jan 21, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add VGZ_ flags to pass to Gzip function to insulate from zlib
parent
5ef82382
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
11 deletions
+21
-11
cache.h
bin/varnishd/cache.h
+2
-1
cache_esi.h
bin/varnishd/cache_esi.h
+1
-2
cache_esi_parse.c
bin/varnishd/cache_esi_parse.c
+5
-5
cache_gzip.c
bin/varnishd/cache_gzip.c
+13
-3
No files found.
bin/varnishd/cache.h
View file @
ab76cb9a
...
...
@@ -626,12 +626,13 @@ void Fetch_Init(void);
/* cache_gzip.c */
struct
vgz
;
enum
vgz_flag
{
VGZ_NORMAL
,
VGZ_ALIGN
,
VGZ_RESET
,
VGZ_FINISH
};
struct
vgz
*
VGZ_NewUngzip
(
const
struct
sess
*
sp
,
struct
ws
*
tmp
);
struct
vgz
*
VGZ_NewGzip
(
const
struct
sess
*
sp
,
struct
ws
*
tmp
);
void
VGZ_Ibuf
(
struct
vgz
*
,
const
void
*
,
ssize_t
len
);
int
VGZ_IbufEmpty
(
struct
vgz
*
vg
);
void
VGZ_Obuf
(
struct
vgz
*
,
const
void
*
,
ssize_t
len
);
int
VGZ_Gzip
(
struct
vgz
*
,
const
void
**
,
size_t
*
len
,
int
flag
);
int
VGZ_Gzip
(
struct
vgz
*
,
const
void
**
,
size_t
*
len
,
enum
vgz_
flag
);
int
VGZ_Gunzip
(
struct
vgz
*
,
const
void
**
,
size_t
*
len
);
void
VGZ_Destroy
(
struct
vgz
**
);
...
...
bin/varnishd/cache_esi.h
View file @
ab76cb9a
...
...
@@ -38,9 +38,8 @@
#define VEC_S8 (0x60 + 8)
#define VEC_INCL 'I'
enum
vep_flg
{
VEP_NORMAL
,
VEP_ALIGN
,
VEP_RESET
,
VEP_FINISH
};
typedef
ssize_t
vep_callback_t
(
const
struct
sess
*
sp
,
ssize_t
l
,
enum
v
ep_fl
g
flg
);
ssize_t
l
,
enum
v
gz_fla
g
flg
);
void
VEP_Init
(
const
struct
sess
*
sp
,
vep_callback_t
*
cb
);
void
VEP_parse
(
const
struct
sess
*
sp
,
const
char
*
p
,
size_t
l
);
...
...
bin/varnishd/cache_esi_parse.c
View file @
ab76cb9a
...
...
@@ -329,7 +329,7 @@ vep_mark_common(struct vep_state *vep, const char *p, enum vep_mark mark)
if
(
vep
->
last_mark
!=
mark
&&
vep
->
o_wait
>
0
)
{
lcb
=
vep
->
cb
(
vep
->
sp
,
0
,
mark
==
VERBATIM
?
V
EP_RESET
:
VEP
_ALIGN
);
mark
==
VERBATIM
?
V
GZ_RESET
:
VGZ
_ALIGN
);
vep_emit_common
(
vep
,
lcb
-
vep
->
o_last
,
vep
->
last_mark
);
vep
->
o_last
=
lcb
;
vep
->
o_wait
=
0
;
...
...
@@ -337,7 +337,7 @@ vep_mark_common(struct vep_state *vep, const char *p, enum vep_mark mark)
/* Transfer pending bytes CRC into active mode CRC */
if
(
vep
->
o_pending
)
{
(
void
)
vep
->
cb
(
vep
->
sp
,
vep
->
o_pending
,
V
EP
_NORMAL
);
(
void
)
vep
->
cb
(
vep
->
sp
,
vep
->
o_pending
,
V
GZ
_NORMAL
);
if
(
vep
->
o_crc
==
0
)
{
vep
->
crc
=
vep
->
crcp
;
vep
->
o_crc
=
vep
->
o_pending
;
...
...
@@ -361,7 +361,7 @@ vep_mark_common(struct vep_state *vep, const char *p, enum vep_mark mark)
vep
->
o_wait
+=
l
;
vep
->
last_mark
=
mark
;
(
void
)
vep
->
cb
(
vep
->
sp
,
l
,
V
EP
_NORMAL
);
(
void
)
vep
->
cb
(
vep
->
sp
,
l
,
V
GZ
_NORMAL
);
}
static
void
...
...
@@ -966,7 +966,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
*/
static
ssize_t
vep_default_cb
(
const
struct
sess
*
sp
,
ssize_t
l
,
enum
v
ep_fl
g
flg
)
vep_default_cb
(
const
struct
sess
*
sp
,
ssize_t
l
,
enum
v
gz_fla
g
flg
)
{
(
void
)
flg
;
...
...
@@ -1020,7 +1020,7 @@ VEP_Finish(const struct sess *sp)
if
(
vep
->
o_pending
)
vep_mark_common
(
vep
,
vep
->
ver_p
,
vep
->
last_mark
);
if
(
vep
->
o_wait
>
0
)
{
lcb
=
vep
->
cb
(
vep
->
sp
,
0
,
V
EP
_FINISH
);
lcb
=
vep
->
cb
(
vep
->
sp
,
0
,
V
GZ
_FINISH
);
vep_emit_common
(
vep
,
lcb
-
vep
->
o_last
,
vep
->
last_mark
);
}
...
...
bin/varnishd/cache_gzip.c
View file @
ab76cb9a
...
...
@@ -66,6 +66,7 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include "svnid.h"
SVNID
(
"$Id$"
)
...
...
@@ -251,9 +252,10 @@ VGZ_Gunzip(struct vgz *vg, const void **pptr, size_t *plen)
/*--------------------------------------------------------------------*/
int
VGZ_Gzip
(
struct
vgz
*
vg
,
const
void
**
pptr
,
size_t
*
plen
,
int
flags
)
VGZ_Gzip
(
struct
vgz
*
vg
,
const
void
**
pptr
,
size_t
*
plen
,
enum
vgz_flag
flags
)
{
int
i
;
int
zflg
;
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
...
...
@@ -262,7 +264,14 @@ VGZ_Gzip(struct vgz *vg, const void **pptr, size_t *plen, int flags)
AN
(
vg
->
vz
.
next_out
);
AN
(
vg
->
vz
.
avail_out
);
vg
->
before
=
vg
->
vz
.
next_out
;
i
=
deflate
(
&
vg
->
vz
,
flags
);
switch
(
flags
)
{
case
VGZ_NORMAL
:
zflg
=
Z_NO_FLUSH
;
break
;
case
VGZ_ALIGN
:
zflg
=
Z_SYNC_FLUSH
;
break
;
case
VGZ_RESET
:
zflg
=
Z_FULL_FLUSH
;
break
;
case
VGZ_FINISH
:
zflg
=
Z_FINISH
;
break
;
default:
INCOMPL
();
}
i
=
deflate
(
&
vg
->
vz
,
zflg
);
if
(
i
==
Z_OK
||
i
==
Z_STREAM_END
)
{
*
pptr
=
vg
->
before
;
*
plen
=
(
const
uint8_t
*
)
vg
->
vz
.
next_out
-
(
const
uint8_t
*
)
vg
->
before
;
...
...
@@ -436,7 +445,8 @@ vfp_gzip_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
bytes
-=
w
;
}
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
bytes
==
0
?
Z_FINISH
:
0
);
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
bytes
==
0
?
VGZ_FINISH
:
VGZ_NORMAL
);
assert
(
i
==
Z_OK
||
i
==
Z_STREAM_END
);
st
->
len
=
st
->
space
-
dl
;
if
(
st
->
len
==
st
->
space
)
{
...
...
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