r5709 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Tue Jan 11 11:04:07 CET 2011


Author: phk
Date: 2011-01-11 11:04:07 +0100 (Tue, 11 Jan 2011)
New Revision: 5709

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Always call the fetch_begin function, also for chunked and eof



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2011-01-11 09:18:20 UTC (rev 5708)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2011-01-11 10:04:07 UTC (rev 5709)
@@ -51,7 +51,7 @@
  */
 
 static void
-fetch_estimate(const struct sess *sp, size_t estimate)
+fetch_begin(const struct sess *sp, size_t estimate)
 {
 
 	AZ(sp->wrk->storage);
@@ -60,7 +60,8 @@
 		WSL(sp->wrk, SLT_Debug, sp->fd,
 		    "Fetch %d byte segments:", fetchfrag);
 	}
-	sp->wrk->storage = STV_alloc(sp, estimate);
+	if (estimate > 0)
+		sp->wrk->storage = STV_alloc(sp, estimate);
 }
 
 /*--------------------------------------------------------------------
@@ -167,7 +168,7 @@
 	if (cl == 0)
 		return (0);
 
-	fetch_estimate(sp, cl);
+	fetch_begin(sp, cl);
 
 	i = fetch_bytes(sp, htc, cl);
 	if (i <= 0) {
@@ -198,6 +199,7 @@
 	unsigned u;
 	ssize_t cl;
 
+	fetch_begin(sp, 0);
 	assert(sp->wrk->body_status == BS_CHUNKED);
 	do {
 		/* Skip leading whitespace */
@@ -265,6 +267,7 @@
 	int i;
 
 	assert(sp->wrk->body_status == BS_EOF);
+	fetch_begin(sp, 0);
 	i = fetch_bytes(sp, htc, 1000000000000);	/* XXX ? */
 	if (i < 0) {
 		WSP(sp, SLT_FetchError, "eof read_error: %d (%s)",




More information about the varnish-commit mailing list