[master] f336ffe Commit the actual fix for #1014 and not just the test-case.

Poul-Henning Kamp phk at varnish-cache.org
Mon Sep 12 12:14:59 CEST 2011


commit f336ffe66fe7f0a565539cf83e46aa93ba96f5ef
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 12 10:14:27 2011 +0000

    Commit the actual fix for #1014 and not just the test-case.
    
    Fixes	#1014

diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index 36df887..73edaa1 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -202,20 +202,15 @@ fetch_straight(struct sess *sp, struct http_conn *htc, const char *b)
 	ssize_t cl;
 
 	assert(sp->wrk->body_status == BS_LENGTH);
+
 	cl = fetch_number(b, 10);
+	sp->wrk->vfp->begin(sp, cl > 0 ? cl : 0);
 	if (cl < 0) {
 		WSP(sp, SLT_FetchError, "straight length field bogus");
 		return (-1);
-	}
-	/*
-	 * XXX: we shouldn't need this if we have cl==0
-	 * XXX: but we must also conditionalize the vfp->end()
-	 */
-	sp->wrk->vfp->begin(sp, cl);
-	if (cl == 0)
+	} else if (cl == 0)
 		return (0);
 
-
 	i = sp->wrk->vfp->bytes(sp, htc, cl);
 	if (i <= 0) {
 		WSP(sp, SLT_FetchError, "straight read_error: %d %d (%s)",
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 675718a..b32b5cf 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -600,6 +600,7 @@ vfp_testgzip_begin(struct sess *sp, size_t estimate)
 {
 	(void)estimate;
 	sp->wrk->vgz_rx = VGZ_NewUngzip(sp, "u F -");
+	CHECK_OBJ_NOTNULL(sp->wrk->vgz_rx, VGZ_MAGIC);
 }
 
 static int __match_proto__()



More information about the varnish-commit mailing list