r4280 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Oct 8 11:17:03 CEST 2009


Author: tfheen
Date: 2009-10-08 11:17:03 +0200 (Thu, 08 Oct 2009)
New Revision: 4280

Added:
   branches/2.0/varnish-cache/bin/varnishtest/tests/e00016.vtc
Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c
   branches/2.0/varnish-cache/bin/varnishtest/tests/e00015.vtc
Log:
Merge r4068, r4077, 4081: Prevent turning off ESI in a subrequest

r4068:
There is probably a bug if an ESI subrequest turns ESI delivery back
on -- add reminder so I can circle back and extend the test for it

r4077:
It turns out that you could turn off ESI processing for subrequest and
completely hose the response. Ignore the flag if you are in a
subrequest.

r4081:
I am stupid, missing '/'



Modified: branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c	2009-10-07 10:22:27 UTC (rev 4279)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c	2009-10-08 09:17:03 UTC (rev 4280)
@@ -502,7 +502,10 @@
 VRT_l_req_esi(struct sess *sp, unsigned process_esi)
 {
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	sp->disable_esi = !process_esi;
+	/* only allow you to turn of esi in the main request
+	   else everything gets confused */
+	if(sp->esis == 0)
+	   sp->disable_esi = !process_esi;
 }
 
 unsigned

Modified: branches/2.0/varnish-cache/bin/varnishtest/tests/e00015.vtc
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/e00015.vtc	2009-10-07 10:22:27 UTC (rev 4279)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/e00015.vtc	2009-10-08 09:17:03 UTC (rev 4280)
@@ -2,7 +2,6 @@
 
 test "ESI requests turned off"
 
-
 server s1 {
 	rxreq 
 	txresp -body {

Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/e00016.vtc (from rev 4077, trunk/varnish-cache/bin/varnishtest/tests/e00016.vtc)
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/e00016.vtc	                        (rev 0)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/e00016.vtc	2009-10-08 09:17:03 UTC (rev 4280)
@@ -0,0 +1,49 @@
+# $Id: e00015.vtc 4068 2009-05-11 08:50:45Z sky $
+
+test "ESI request can't be turned off midstream"
+
+server s1 {
+	rxreq 
+	txresp -body {
+		<html>
+		Before include
+		<esi:include src="/body"/>
+		<esi:include src="/body3"/>
+		After include
+	}
+	rxreq 
+	expect req.url == "/body"
+	txresp -body {
+	       <esi:include src="/body2"/>
+	}
+	rxreq
+	expect req.url == "/body2"
+	txresp -body {
+	       included
+	}
+	rxreq
+	expect req.url == "/body3"
+	txresp -body {
+	       included body3
+	}
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+ 	    	set req.esi = true;	
+	    	if(req.url == "/body") {
+		   set req.esi = false;
+		} 
+		esi;
+	}
+} -start
+
+client c1 {
+        txreq
+	rxresp
+	expect resp.bodylen == 105
+	expect resp.status == 200
+}
+
+client c1 -run
+varnish v1 -expect esi_errors == 0



More information about the varnish-commit mailing list