[master] feafbe2 Handle the case where we already have a full buffer on entry.

Poul-Henning Kamp phk at varnish-cache.org
Wed Mar 30 13:01:44 CEST 2011


commit feafbe2548f10b72be151bc4d4abf0e927d31938
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 30 11:01:29 2011 +0000

    Handle the case where we already have a full buffer on entry.

diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 0222cfd..4809a3e 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -367,12 +367,16 @@ VGZ_WrwGunzip(struct sess *sp, struct vgz *vg, void *ibuf, ssize_t ibufl,
 	VGZ_Ibuf(vg, ibuf, ibufl);
 	VGZ_Obuf(vg, obuf + *obufp, ibufl - *obufp);
 	do {
-		i = VGZ_Gunzip(vg, &dp, &dl);
+		if (obufl == *obufp)
+			i = VGZ_STUCK;
+		else {
+			i = VGZ_Gunzip(vg, &dp, &dl);
+			*obufp += dl;
+		}
 		if (i < VGZ_OK) {
 			/* XXX: VSL ? */
 			return (-1);
 		}
-		*obufp += dl;
 		if (obufl == *obufp || i == VGZ_STUCK) {
 			WRW_Write(sp->wrk, obuf, *obufp);
 			if (WRW_Flush(sp->wrk))



More information about the varnish-commit mailing list