r5706 - in trunk/varnish-cache: bin/varnishd bin/varnishtest/tests lib/libvcl

phk at varnish-cache.org phk at varnish-cache.org
Mon Jan 10 13:37:48 CET 2011


Author: phk
Date: 2011-01-10 13:37:47 +0100 (Mon, 10 Jan 2011)
New Revision: 5706

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_esi.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_panic.c
   trunk/varnish-cache/bin/varnishd/cache_vrt_var.c
   trunk/varnish-cache/bin/varnishtest/tests/e00003.vtc
   trunk/varnish-cache/lib/libvcl/generate.py
Log:
Rename sp->esis to sp->esi_level and make it available in VCL as
req.vcl_level.

Fixes: #782


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2011-01-10 12:37:47 UTC (rev 5706)
@@ -434,7 +434,7 @@
 	unsigned		xid;
 
 	int			restarts;
-	int			esis;
+	int			esi_level;
 	int			disable_esi;
 
 	uint8_t			hash_ignore_busy;

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2011-01-10 12:37:47 UTC (rev 5706)
@@ -174,7 +174,7 @@
 		sp->wrk->res_mode |= RES_ESI;
 	}
 
-	if (sp->esis > 0) {
+	if (sp->esi_level > 0) {
 		sp->wrk->res_mode &= ~RES_LEN;
 		sp->wrk->res_mode |= RES_ESI_CHILD;
 	}
@@ -273,7 +273,7 @@
 	sp->director = NULL;
 	sp->restarts = 0;
 
-	if (sp->vcl != NULL && sp->esis == 0) {
+	if (sp->vcl != NULL && sp->esi_level == 0) {
 		if (sp->wrk->vcl != NULL)
 			VCL_Rel(&sp->wrk->vcl);
 		sp->wrk->vcl = sp->vcl;
@@ -287,7 +287,7 @@
 	if (sp->xid == 0) {
 		sp->t_req = sp->t_end;
 		sp->t_resp = sp->t_end;
-	} else if (sp->esis == 0) {
+	} else if (sp->esi_level == 0) {
 		dp = sp->t_resp - sp->t_req;
 		da = sp->t_end - sp->t_resp;
 		dh = sp->t_req - sp->t_open;
@@ -302,7 +302,7 @@
 	WSL_Flush(sp->wrk, 0);
 
 	/* If we did an ESI include, don't mess up our state */
-	if (sp->esis > 0)
+	if (sp->esi_level > 0)
 		return (1);
 
 	memset(&sp->acct_req, 0, sizeof sp->acct_req);
@@ -1126,7 +1126,7 @@
 		sp->step = STP_LOOKUP;
 		return (0);
 	case VCL_RET_PIPE:
-		if (sp->esis > 0) {
+		if (sp->esi_level > 0) {
 			/* XXX: VSL something */
 			INCOMPL();
 			/* sp->step = STP_DONE; */

Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_esi.c	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishd/cache_esi.c	2011-01-10 12:37:47 UTC (rev 5706)
@@ -874,7 +874,7 @@
 				(void)WRW_Write(w, "\r\n", -1);
 		}
 		if (eb->include.b == NULL ||
-		    sp->esis >= params->max_esi_includes)
+		    sp->esi_level >= params->max_esi_includes)
 			continue;
 
 		if (WRW_Flush(w)) {
@@ -883,7 +883,7 @@
 		}
 		AZ(WRW_FlushRelease(w));
 
-		sp->esis++;
+		sp->esi_level++;
 		obj = sp->obj;
 		sp->obj = NULL;
 		res_mode = sp->wrk->res_mode;
@@ -934,7 +934,7 @@
 		sp->xid = sxid;
 		AN(sp->wrk);
 		assert(sp->step == STP_DONE);
-		sp->esis--;
+		sp->esi_level--;
 		sp->obj = obj;
 		sp->wrk->res_mode = res_mode;
 

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2011-01-10 12:37:47 UTC (rev 5706)
@@ -429,7 +429,7 @@
 
 	if (busy_oc != NULL) {
 		/* There are one or more busy objects, wait for them */
-		if (sp->esis == 0) {
+		if (sp->esi_level == 0) {
 			CHECK_OBJ_NOTNULL(sp->wrk->nwaitinglist,
 			    WAITINGLIST_MAGIC);
 			if (oh->waitinglist == NULL) {

Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c	2011-01-10 12:37:47 UTC (rev 5706)
@@ -238,8 +238,8 @@
 		    "  err_code = %d, err_reason = %s,\n", sp->err_code,
 		    sp->err_reason ? sp->err_reason : "(null)");
 
-	vsb_printf(vsp, "  restarts = %d, esis = %d\n",
-	    sp->restarts, sp->esis);
+	vsb_printf(vsp, "  restarts = %d, esi_level = %d\n",
+	    sp->restarts, sp->esi_level);
 
 	pan_ws(sp->ws, 2);
 	pan_http("req", sp->http, 2);

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_var.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_var.c	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_var.c	2011-01-10 12:37:47 UTC (rev 5706)
@@ -412,7 +412,7 @@
 	 * Only allow you to turn of esi in the main request
 	 * else everything gets confused
 	 */
-	if(sp->esis == 0)
+	if(sp->esi_level == 0)
 		sp->disable_esi = !process_esi;
 }
 
@@ -423,6 +423,14 @@
 	return (!sp->disable_esi);
 }
 
+int
+VRT_r_req_esi_level(const struct sess *sp)
+{
+
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	return(sp->esi_level);
+}
+
 /*--------------------------------------------------------------------*/
 
 unsigned __match_proto__()

Modified: trunk/varnish-cache/bin/varnishtest/tests/e00003.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/e00003.vtc	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/bin/varnishtest/tests/e00003.vtc	2011-01-10 12:37:47 UTC (rev 5706)
@@ -12,13 +12,18 @@
 		After include
 	}
 	rxreq 
-	expect req.url == "/body"
+	expect req.url == "/body1"
 	txresp -body {
 		Included file
 	}
 } -start
 
 varnish v1 -vcl+backend {
+	sub vcl_recv {
+		if (req.esi_level > 0) {
+			set req.url = req.url + req.esi_level;
+		}
+	}
 	sub vcl_fetch {
 		esi;
 	}

Modified: trunk/varnish-cache/lib/libvcl/generate.py
===================================================================
--- trunk/varnish-cache/lib/libvcl/generate.py	2011-01-10 12:09:18 UTC (rev 5705)
+++ trunk/varnish-cache/lib/libvcl/generate.py	2011-01-10 12:37:47 UTC (rev 5706)
@@ -172,6 +172,12 @@
 		( ),
 		'const struct sess *'
 	),
+	('req.esi_level',
+		'INT',
+		( 'all',),
+		( ),
+		'const struct sess *'
+	),
 	('req.grace',
 		'DURATION',
 		( 'all',),




More information about the varnish-commit mailing list