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
fd0ff2b0
Commit
fd0ff2b0
authored
Mar 28, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more systematic about the returns from VGZ_Unzip() and pay attention
to the VGZ_STUCK indication. Hopefully helps with #869
parent
149fde92
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
17 deletions
+26
-17
cache.h
bin/varnishd/cache.h
+6
-0
cache_esi_deliver.c
bin/varnishd/cache_esi_deliver.c
+10
-6
cache_esi_fetch.c
bin/varnishd/cache_esi_fetch.c
+2
-3
cache_gzip.c
bin/varnishd/cache_gzip.c
+6
-6
cache_response.c
bin/varnishd/cache_response.c
+2
-2
No files found.
bin/varnishd/cache.h
View file @
fd0ff2b0
...
...
@@ -690,6 +690,12 @@ int VGZ_Gunzip(struct vgz *, const void **, size_t *len);
void
VGZ_Destroy
(
struct
vgz
**
);
void
VGZ_UpdateObj
(
const
struct
vgz
*
,
struct
object
*
);
/* Return values */
#define VGZ_ERROR -1
#define VGZ_OK 0
#define VGZ_END 1
#define VGZ_STUCK 2
/* cache_http.c */
unsigned
HTTP_estimate
(
unsigned
nhttp
);
void
HTTP_Copy
(
struct
http
*
to
,
const
struct
http
*
const
fm
);
...
...
bin/varnishd/cache_esi_deliver.c
View file @
fd0ff2b0
...
...
@@ -274,7 +274,7 @@ ESI_Deliver(struct sess *sp)
VGZ_Ibuf
(
vgz
,
gzip_hdr
,
sizeof
gzip_hdr
);
VGZ_Obuf
(
vgz
,
obuf
,
sizeof
obuf
);
i
=
VGZ_Gunzip
(
vgz
,
&
dp
,
&
dl
);
assert
(
i
==
Z_OK
||
i
==
Z_STREAM_END
);
assert
(
i
==
VGZ_OK
);
assert
(
VGZ_IbufEmpty
(
vgz
));
assert
(
dl
==
0
);
...
...
@@ -321,16 +321,20 @@ ESI_Deliver(struct sess *sp)
AN
(
vgz
);
VGZ_Ibuf
(
vgz
,
st
->
ptr
+
off
,
l
);
do
{
if
(
obufl
==
sizeof
obuf
)
{
WRW_Write
(
sp
->
wrk
,
obuf
,
obufl
);
obufl
=
0
;
}
VGZ_Obuf
(
vgz
,
obuf
+
obufl
,
sizeof
obuf
-
obufl
);
i
=
VGZ_Gunzip
(
vgz
,
&
dp
,
&
dl
);
assert
(
i
==
Z_OK
||
i
==
Z_STREAM_END
);
assert
(
i
>=
VGZ_OK
);
obufl
+=
dl
;
assert
(
obufl
<=
sizeof
obuf
);
if
(
obufl
==
sizeof
obuf
||
i
==
VGZ_STUCK
)
{
WRW_Write
(
sp
->
wrk
,
obuf
,
obufl
);
WRW_Flush
(
sp
->
wrk
);
obufl
=
0
;
}
}
while
(
!
VGZ_IbufEmpty
(
vgz
));
assert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
}
else
{
/*
* Ungzip'ed VEC, ungzip'ed ESI response
...
...
bin/varnishd/cache_esi_fetch.c
View file @
fd0ff2b0
...
...
@@ -39,7 +39,6 @@ SVNID("$Id")
#include "cache.h"
#include "cache_esi.h"
#include "vct.h"
#include "vgz.h"
#include "stevedore.h"
/*---------------------------------------------------------------------
...
...
@@ -120,7 +119,7 @@ vfp_esi_bytes_gu(struct sess *sp, struct http_conn *htc, ssize_t bytes)
if
(
VGZ_ObufStorage
(
sp
,
vg
))
return
(
-
1
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
xxxassert
(
i
==
Z_OK
||
i
==
Z_STREAM
_END
);
xxxassert
(
i
==
VGZ_OK
||
i
==
VGZ
_END
);
VEP_parse
(
sp
,
dp
,
dl
);
sp
->
obj
->
len
+=
dl
;
}
...
...
@@ -274,7 +273,7 @@ vfp_esi_bytes_gg(struct sess *sp, struct http_conn *htc, size_t bytes)
VGZ_Obuf
(
sp
->
wrk
->
vgz_rx
,
ibuf2
,
sizeof
ibuf2
);
i
=
VGZ_Gunzip
(
sp
->
wrk
->
vgz_rx
,
&
dp
,
&
dl
);
/* XXX: check i */
assert
(
i
>=
0
);
assert
(
i
>=
VGZ_OK
);
vef
->
bufp
=
ibuf2
;
if
(
dl
>
0
)
VEP_parse
(
sp
,
ibuf2
,
dl
);
...
...
bin/varnishd/cache_gzip.c
View file @
fd0ff2b0
...
...
@@ -300,13 +300,13 @@ VGZ_Gunzip(struct vgz *vg, const void **pptr, size_t *plen)
vg
->
obuf
->
len
+=
l
;
}
if
(
i
==
Z_OK
)
return
(
0
);
return
(
VGZ_OK
);
if
(
i
==
Z_STREAM_END
)
return
(
1
);
return
(
VGZ_END
);
if
(
i
==
Z_BUF_ERROR
)
return
(
2
);
return
(
VGZ_STUCK
);
printf
(
"INFLATE=%d (%s)
\n
"
,
i
,
vg
->
vz
.
msg
);
return
(
-
1
);
return
(
VGZ_ERROR
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -432,7 +432,7 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
if
(
VGZ_ObufStorage
(
sp
,
vg
))
return
(
-
1
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
assert
(
i
==
Z_OK
||
i
==
Z_STREAM
_END
);
assert
(
i
==
VGZ_OK
||
i
==
VGZ
_END
);
sp
->
obj
->
len
+=
dl
;
}
if
(
i
==
Z_OK
||
i
==
Z_STREAM_END
)
...
...
@@ -584,7 +584,7 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
while
(
!
VGZ_IbufEmpty
(
vg
))
{
VGZ_Obuf
(
vg
,
ibuf
,
sizeof
ibuf
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
if
(
i
!=
Z_OK
&&
i
!=
Z_STREAM
_END
)
{
if
(
i
!=
VGZ_OK
&&
i
!=
VGZ
_END
)
{
WSP
(
sp
,
SLT_FetchError
,
"Invalid Gzip data: %s"
,
vg
->
vz
.
msg
);
return
(
-
1
);
...
...
bin/varnishd/cache_response.c
View file @
fd0ff2b0
...
...
@@ -266,13 +266,13 @@ res_WriteGunzipObj(struct sess *sp)
do
{
VGZ_Obuf
(
vg
,
obuf
,
sizeof
obuf
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
assert
(
i
>=
VGZ_OK
);
if
(
dl
!=
0
)
{
(
void
)
WRW_Write
(
sp
->
wrk
,
dp
,
dl
);
if
(
WRW_Flush
(
sp
->
wrk
))
break
;
}
assert
(
i
>=
0
);
}
while
(
i
==
0
);
}
while
(
!
VGZ_IbufEmpty
(
vg
));
}
VGZ_Destroy
(
&
vg
);
assert
(
u
==
sp
->
obj
->
len
);
...
...
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