r3433 - in trunk/varnish-cache/bin: varnishd varnishtest/tests

phk at projects.linpro.no phk at projects.linpro.no
Tue Nov 25 09:37:34 CET 2008


Author: phk
Date: 2008-11-25 09:37:34 +0100 (Tue, 25 Nov 2008)
New Revision: 3433

Added:
   trunk/varnish-cache/bin/varnishtest/tests/r00386.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
Log:
When we receive an If-Modified-Since on an ESI object, do not process the conditional
for the child object and pretend to send a 304 reply for them, if we have decided to
deliver the main object.

Fixes #386


Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2008-11-24 20:21:51 UTC (rev 3432)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2008-11-25 08:37:34 UTC (rev 3433)
@@ -841,7 +841,14 @@
 		sp->director = NULL;
 		sp->step = STP_RECV;
 		http_ForceGet(sp->http);
+
+		/* Don't do conditionals */
+		sp->http->conds = 0;
+		http_Unset(sp->http, H_If_Modified_Since);
+
+		/* Client content already taken care of */
 		http_Unset(sp->http, H_Content_Length);
+
 		while (1) {
 			CNT_Session(sp);
 			if (sp->step == STP_DONE)

Added: trunk/varnish-cache/bin/varnishtest/tests/r00386.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00386.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00386.vtc	2008-11-25 08:37:34 UTC (rev 3433)
@@ -0,0 +1,29 @@
+# $Id$
+
+test "#386, failure to insert include"
+
+server s1 {
+	rxreq
+	expect req.url == "/body"
+	txresp -hdr "Last-Modified: Tue, 25 Nov 2008 00:00:00 GMT" -body "BODY"
+	rxreq 
+	expect req.url == "/"
+	txresp -body {<X><esi:include src="/body"/></X>}
+} -start
+
+varnish v1 -arg "-p diag_bitmap=0x20" -vcl+backend {
+	sub vcl_fetch {
+		if (req.url == "/") {
+			esi;
+		}
+	}
+} -start
+
+client c1 {
+	txreq -url /body
+	rxresp
+	expect resp.bodylen == 4
+	txreq -url / -hdr "If-Modified-Since:  Tue, 25 Nov 2008 00:00:00 GMT"
+	rxresp
+	expect resp.bodylen == 11
+} -start



More information about the varnish-commit mailing list