r4049 - trunk/varnish-cache/bin/varnishd

sky at projects.linpro.no sky at projects.linpro.no
Mon May 4 15:48:25 CEST 2009


Author: sky
Date: 2009-05-04 15:48:25 +0200 (Mon, 04 May 2009)
New Revision: 4049

Modified:
   trunk/varnish-cache/bin/varnishd/cache_esi.c
   trunk/varnish-cache/bin/varnishd/cache_response.c
Log:
Move the setting of the correct headers for ESI from ESI parsing time to delivery time. 
This is in anticipation for set req.esi = off;


Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_esi.c	2009-05-04 08:05:29 UTC (rev 4048)
+++ trunk/varnish-cache/bin/varnishd/cache_esi.c	2009-05-04 13:48:25 UTC (rev 4049)
@@ -739,13 +739,6 @@
 	if (ew->incmt)
 		esi_error(ew, ew->t.e, -1,
 		    "ESI 1.0 unterminated <!--esi comment");
-
-	/*
-	 * Our ESI implementation needs chunked encoding
-	 */
-	http_Unset(sp->obj->http, H_Content_Length);
-	http_PrintfHeader(sp->wrk, sp->fd, sp->obj->http,
-	    "Transfer-Encoding: chunked");
 }
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2009-05-04 08:05:29 UTC (rev 4048)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2009-05-04 13:48:25 UTC (rev 4049)
@@ -106,8 +106,11 @@
 	    HTTPH_A_DELIVER);
 
 	/* Only HTTP 1.1 can do Chunked encoding */
-	if (sp->http->protover < 1.1 && !VTAILQ_EMPTY(&sp->obj->esibits))
-		http_Unset(sp->wrk->resp, H_Transfer_Encoding);
+	if (!VTAILQ_EMPTY(&sp->obj->esibits)) {
+		http_Unset(sp->wrk->resp, H_Content_Length);
+		if(sp->http->protover >= 1.1)
+			http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Transfer-Encoding: chunked");
+	}
 
 	TIM_format(TIM_real(), time_str);
 	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", time_str);



More information about the varnish-commit mailing list