r2172 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Oct 26 13:13:32 CEST 2007


Author: phk
Date: 2007-10-26 13:13:32 +0200 (Fri, 26 Oct 2007)
New Revision: 2172

Modified:
   trunk/varnish-cache/bin/varnishd/cache_response.c
   trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
Log:
Don't mess up the chunked encoding for nested esi:include


Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2007-10-26 11:00:25 UTC (rev 2171)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2007-10-26 11:13:32 UTC (rev 2172)
@@ -153,19 +153,20 @@
 	char lenbuf[20];
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 
 	WRK_Reset(sp->wrk, &sp->fd);
-	if (sp->esis == 0) {
+	if (sp->esis == 0)
 		sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
-	} else {
-		sprintf(lenbuf, "%x\r\n", sp->obj->len);
-		sp->wrk->acct.hdrbytes += WRK_Write(sp->wrk, lenbuf, -1);
-	}
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 
 	if (sp->wantbody && !VTAILQ_EMPTY(&sp->obj->esibits)) {
 		ESI_Deliver(sp);
 	} else if (sp->wantbody) {
+		if (sp->esis > 0) {
+			sprintf(lenbuf, "%x\r\n", sp->obj->len);
+			sp->wrk->acct.hdrbytes +=
+			    WRK_Write(sp->wrk, lenbuf, -1);
+		}
 		
 		VTAILQ_FOREACH(st, &sp->obj->store, list) {
 			CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
@@ -191,9 +192,9 @@
 			WRK_Write(sp->wrk, st->ptr, st->len);
 		}
 		assert(u == sp->obj->len);
+		if (sp->esis > 0) 
+			WRK_Write(sp->wrk, "\r\n", -1);
 	}
-	if (sp->esis > 0) 
-		WRK_Write(sp->wrk, "\r\n", -1);
 	if (WRK_Flush(sp->wrk))
 		vca_close_session(sp, "remote closed");
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2007-10-26 11:00:25 UTC (rev 2171)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2007-10-26 11:13:32 UTC (rev 2172)
@@ -605,7 +605,8 @@
 		sp->obj = obj;
 
 	}
-	WRK_Write(sp->wrk, "0\r\n", -1);
+	if (sp->esis == 0)
+		WRK_Write(sp->wrk, "0\r\n", -1);
 }
 
 /*--------------------------------------------------------------------*/




More information about the varnish-commit mailing list