r5686 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Wed Jan 5 13:10:13 CET 2011


Author: phk
Date: 2011-01-05 13:10:11 +0100 (Wed, 05 Jan 2011)
New Revision: 5686

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_response.c
Log:
Use sp->wrk->res_mode more.



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2011-01-05 11:13:30 UTC (rev 5685)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2011-01-05 12:10:11 UTC (rev 5686)
@@ -171,8 +171,14 @@
 	if (!sp->disable_esi && sp->obj->esidata != NULL) {
 		/* In ESI mode, we don't know the aggregate length */
 		sp->wrk->res_mode &= ~RES_LEN;
+		sp->wrk->res_mode |= RES_ESI;
 	}
 
+	if (sp->esis > 0) {
+		sp->wrk->res_mode &= ~RES_LEN;
+		sp->wrk->res_mode |= RES_ESI_CHILD;
+	}
+
 	if (params->http_gzip_support &&
 	    http_HdrIs(sp->obj->http, H_Content_Encoding, "gzip") &&
 	    !RFC2616_Req_Gzip(sp) &&

Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2011-01-05 11:13:30 UTC (rev 5685)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2011-01-05 12:10:11 UTC (rev 5686)
@@ -246,19 +246,13 @@
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 
-	if (sp->wrk->res_mode & RES_GUNZIP) {
-		RES_WriteGunzipObj(sp);
-		return;
-	}
-
 	WRW_Reserve(sp->wrk, &sp->fd);
 
 	/*
 	 * ESI objects get special delivery
 	 */
-	if (!sp->disable_esi && sp->obj->esidata != NULL) {
-
-		if (sp->esis == 0)
+	if (sp->wrk->res_mode & RES_ESI) {
+		if (!(sp->wrk->res_mode & RES_ESI_CHILD))
 			/* no headers for interior ESI includes */
 			sp->acct_tmp.hdrbytes +=
 			    http_Write(sp->wrk, sp->wrk->resp, 1);
@@ -270,13 +264,18 @@
 		return;
 	}
 
+	if (sp->wrk->res_mode & RES_GUNZIP) {
+		RES_WriteGunzipObj(sp);
+		return;
+	}
+
 	/*
 	 * How much of the object we want to deliver
 	 */
 	low = 0;
 	high = sp->obj->len - 1;
 
-	if (sp->disable_esi || sp->esis == 0) {
+	if (!(sp->wrk->res_mode & (RES_ESI|RES_ESI_CHILD))) {
 		/* For non-ESI and non ESI-included objects, try Range */
 		if (params->http_range_support &&
 		    (sp->disable_esi || sp->esis == 0) &&
@@ -286,14 +285,7 @@
 			res_dorange(sp, r, &low, &high);
 
 		sp->acct_tmp.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1);
-	} else if (!sp->disable_esi &&
-	    sp->esis > 0 &&
-	    sp->http->protover >= 1.1 &&
-	    sp->obj->len > 0) {
-		/*
-		 * Interior ESI includes (which are not themselves ESI
-		 * objects) use chunked encoding (here) or EOF (nothing)
-		 */
+	} else if (sp->obj->len > 0 && (sp->wrk->res_mode & RES_CHUNKED)) {
 		assert(sp->wantbody);
 		sprintf(lenbuf, "%x\r\n", sp->obj->len);
 		(void)WRW_Write(sp->wrk, lenbuf, -1);
@@ -383,8 +375,6 @@
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	AN(sp->wantbody);
 
-	WRW_Reserve(sp->wrk, &sp->fd);
-
 	/* We don't know the length  (XXX: Cache once we do ?) */
 	http_Unset(sp->wrk->resp, H_Content_Length);
 	http_Unset(sp->wrk->resp, H_Content_Encoding);




More information about the varnish-commit mailing list