Commit 7ccd8e60 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Generally test on req-toppines rather than esi_level

parent e259c586
...@@ -538,6 +538,8 @@ struct req { ...@@ -538,6 +538,8 @@ struct req {
struct vrt_privs privs[1]; struct vrt_privs privs[1];
}; };
#define IS_TOPREQ(req) ((req)->top == NULL || (req)->top->topreq == (req))
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Struct sess is a high memory-load structure because sessions typically * Struct sess is a high memory-load structure because sessions typically
* hang around the waiter for relatively long time. * hang around the waiter for relatively long time.
......
...@@ -256,7 +256,7 @@ ved_vdp_esi_init(struct req *req, void **priv) ...@@ -256,7 +256,7 @@ ved_vdp_esi_init(struct req *req, void **priv)
*priv = ecx; *priv = ecx;
RFC2616_Weaken_Etag(req->resp); RFC2616_Weaken_Etag(req->resp);
if (req->esi_level == 0) { if (IS_TOPREQ(req)) {
Req_MakeTop(req); Req_MakeTop(req);
if (req->top == NULL) { if (req->top == NULL) {
VSLb(req->vsl, SLT_Error, VSLb(req->vsl, SLT_Error,
......
...@@ -63,16 +63,11 @@ Req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req) ...@@ -63,16 +63,11 @@ Req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req)
(uintmax_t)(a->resp_hdrbytes + a->resp_bodybytes)); (uintmax_t)(a->resp_hdrbytes + a->resp_bodybytes));
} }
/* if (IS_TOPREQ(req)) {
* Charge to main byte counters, except for ESI subrequests #define ACCT(foo) ds->s_##foo += a->foo;
* which are charged as they pass through the topreq.
* XXX: make this test req->top instead
*/
#define ACCT(foo) \
if (req->esi_level == 0) \
ds->s_##foo += a->foo; \
a->foo = 0;
#include "tbl/acct_fields_req.h" #include "tbl/acct_fields_req.h"
}
memset(a, 0, sizeof *a);
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
...@@ -216,7 +211,6 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -216,7 +211,6 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
req->director_hint = NULL; req->director_hint = NULL;
req->restarts = 0; req->restarts = 0;
req->top = 0;
AZ(req->privs->magic); AZ(req->privs->magic);
...@@ -244,6 +238,7 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -244,6 +238,7 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
req->hash_ignore_busy = 0; req->hash_ignore_busy = 0;
req->esi_level = 0; req->esi_level = 0;
req->is_hit = 0; req->is_hit = 0;
req->top = 0;
if (WS_Overflowed(req->ws)) if (WS_Overflowed(req->ws))
wrk->stats->ws_client_overflow++; wrk->stats->ws_client_overflow++;
......
...@@ -182,7 +182,7 @@ cnt_deliver(struct worker *wrk, struct req *req) ...@@ -182,7 +182,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
assert(wrk->handling == VCL_RET_DELIVER); assert(wrk->handling == VCL_RET_DELIVER);
if (req->esi_level == 0 && if (IS_TOPREQ(req) &&
http_IsStatus(req->resp, 200) && http_IsStatus(req->resp, 200) &&
req->http->conds && RFC2616_Do_Cond(req)) req->http->conds && RFC2616_Do_Cond(req))
http_PutResponse(req->resp, "HTTP/1.1", 304, NULL); http_PutResponse(req->resp, "HTTP/1.1", 304, NULL);
...@@ -917,7 +917,7 @@ cnt_recv(struct worker *wrk, struct req *req) ...@@ -917,7 +917,7 @@ cnt_recv(struct worker *wrk, struct req *req)
req->req_step = R_STP_LOOKUP; req->req_step = R_STP_LOOKUP;
break; break;
case VCL_RET_PIPE: case VCL_RET_PIPE:
if (req->esi_level > 0) { if (!IS_TOPREQ(req)) {
VSLb(req->vsl, SLT_VCL_Error, VSLb(req->vsl, SLT_VCL_Error,
"vcl_recv{} returns pipe for ESI included object." "vcl_recv{} returns pipe for ESI included object."
" Doing pass."); " Doing pass.");
......
...@@ -520,7 +520,7 @@ VRT_l_req_esi(VRT_CTX, VCL_BOOL process_esi) ...@@ -520,7 +520,7 @@ VRT_l_req_esi(VRT_CTX, VCL_BOOL process_esi)
* Only allow you to turn of esi in the main request * Only allow you to turn of esi in the main request
* else everything gets confused * else everything gets confused
*/ */
if (ctx->req->esi_level == 0) if (IS_TOPREQ(ctx->req))
ctx->req->disable_esi = !process_esi; ctx->req->disable_esi = !process_esi;
} }
......
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