Commit 9d8a7a21 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rename sp->esis to sp->esi_level and make it available in VCL as

req.vcl_level.

Fixes: #782


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5706 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 344089f6
......@@ -434,7 +434,7 @@ struct sess {
unsigned xid;
int restarts;
int esis;
int esi_level;
int disable_esi;
uint8_t hash_ignore_busy;
......
......@@ -174,7 +174,7 @@ cnt_deliver(struct sess *sp)
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 @@ cnt_done(struct sess *sp)
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 @@ cnt_done(struct sess *sp)
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 @@ cnt_done(struct sess *sp)
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 @@ cnt_recv(struct sess *sp)
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; */
......
......@@ -874,7 +874,7 @@ ESI_Deliver(struct sess *sp)
(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 @@ ESI_Deliver(struct sess *sp)
}
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 @@ ESI_Deliver(struct sess *sp)
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;
......
......@@ -429,7 +429,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
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) {
......
......@@ -238,8 +238,8 @@ pan_sess(const struct sess *sp)
" 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);
......
......@@ -412,7 +412,7 @@ VRT_l_req_esi(struct sess *sp, unsigned process_esi)
* 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 @@ VRT_r_req_esi(struct sess *sp)
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__()
......
......@@ -12,13 +12,18 @@ server s1 {
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;
}
......
......@@ -172,6 +172,12 @@ sp_variables = (
( ),
'const struct sess *'
),
('req.esi_level',
'INT',
( 'all',),
( ),
'const struct sess *'
),
('req.grace',
'DURATION',
( 'all',),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment