r4077 - in trunk/varnish-cache/bin: varnishd varnishtest/tests
sky at projects.linpro.no
sky at projects.linpro.no
Wed May 13 23:44:51 CEST 2009
Author: sky
Date: 2009-05-13 23:44:51 +0200 (Wed, 13 May 2009)
New Revision: 4077
Added:
trunk/varnish-cache/bin/varnishtest/tests/e00016.vtc
Modified:
trunk/varnish-cache/bin/varnishd/cache_vrt.c
trunk/varnish-cache/bin/varnishtest/tests/e00015.vtc
Log:
It turns out that you could turn off ESI processing for subrequest and compeltely hose the response. Ignore the flag if you are in a subrequest.
Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2009-05-12 07:28:12 UTC (rev 4076)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2009-05-13 21:44:51 UTC (rev 4077)
@@ -561,7 +561,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: trunk/varnish-cache/bin/varnishtest/tests/e00015.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/e00015.vtc 2009-05-12 07:28:12 UTC (rev 4076)
+++ trunk/varnish-cache/bin/varnishtest/tests/e00015.vtc 2009-05-13 21:44:51 UTC (rev 4077)
@@ -2,9 +2,6 @@
test "ESI requests turned off"
-# There is probably a bug if an ESI subrequest turns ESI delivery back on
-# XXX reminder so I don't forget it
-
server s1 {
rxreq
txresp -body {
Added: trunk/varnish-cache/bin/varnishtest/tests/e00016.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/e00016.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/e00016.vtc 2009-05-13 21:44:51 UTC (rev 4077)
@@ -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