Commit 69d45413 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Use the req->ws for the V1L in the toplevel requests, so that

esi-included requests don't need to know about it.
parent 15fd13e4
......@@ -69,7 +69,6 @@ ved_include(struct req *preq, const char *src, const char *host)
{
struct worker *wrk;
struct req *req;
char *wrk_ws_wm;
enum req_fsm_nxt s;
wrk = preq->wrk;
......@@ -77,11 +76,6 @@ ved_include(struct req *preq, const char *src, const char *host)
if (preq->esi_level >= cache_param->max_esi_depth)
return;
(void)V1L_FlushRelease(preq->wrk);
/* Take a workspace snapshot */
wrk_ws_wm = WS_Snapshot(wrk->aws); /* XXX ? */
req = SES_GetReq(wrk, preq->sp);
req->req_body_status = REQ_BODY_NONE;
AZ(req->vsl->wid);
......@@ -155,19 +149,10 @@ ved_include(struct req *preq, const char *src, const char *host)
AZ(req->wrk);
(void)usleep(10000);
}
AN(V1L_IsReleased(wrk));
CNT_AcctLogCharge(wrk->stats, req);
VSL_End(req->vsl);
/* Reset the workspace */
WS_Reset(wrk->aws, wrk_ws_wm); /* XXX ? */
V1L_Reserve(preq->wrk, preq->wrk->aws, &preq->sp->fd, preq->vsl,
preq->t_prev);
if (preq->res_mode & RES_CHUNKED)
V1L_Chunked(preq->wrk);
preq->vcl = req->vcl;
req->vcl = NULL;
......
......@@ -298,6 +298,31 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
}
VSLb(req->vsl, SLT_Debug, "RES_MODE %x", req->res_mode);
if (req->esi_level > 0) {
if (req->gzip_resp &&
ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) &&
!(req->res_mode & RES_ESI)) {
if (bo != NULL)
VBO_waitstate(bo, BOS_FINISHED);
ESI_DeliverChild(req);
} else {
if (req->gzip_resp &&
!ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
VDP_push(req, VED_pretend_gzip, NULL);
else if (!req->gzip_resp &&
ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
VDP_push(req, VDP_gunzip, NULL);
if (req->res_mode & RES_ESI)
ESI_Deliver(req);
else
(void)v1d_WriteDirObj(req);
}
(void)VDP_bytes(req, VDP_FLUSH, NULL, 0);
VDP_close(req);
return;
}
if (!(req->res_mode & RES_LEN))
http_Unset(req->resp, H_Content_Length);
......@@ -310,15 +335,12 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
http_SetHeader(req->resp,
req->doclose ? "Connection: close" : "Connection: keep-alive");
if (req->esi_level == 0) {
req->vdp_nxt = 0;
VTAILQ_INIT(&req->vdp);
VDP_push(req, v1d_bytes, NULL);
}
req->vdp_nxt = 0;
VTAILQ_INIT(&req->vdp);
VDP_push(req, v1d_bytes, NULL);
if (
req->wantbody &&
req->esi_level == 0 &&
cache_param->http_range_support &&
http_IsStatus(req->resp, 200)) {
http_SetHeader(req->resp, "Accept-Ranges: bytes");
......@@ -326,45 +348,18 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
v1d_dorange(req, bo, r);
}
V1L_Reserve(req->wrk, req->wrk->aws, &req->sp->fd, req->vsl,
req->t_prev);
if (req->res_mode & RES_GUNZIP)
VDP_push(req, VDP_gunzip, NULL);
V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev);
/*
* Send HTTP protocol header, unless interior ESI object
*/
if (!(req->res_mode & RES_ESI_CHILD))
req->acct.resp_hdrbytes +=
HTTP1_Write(req->wrk, req->resp, HTTP1_Resp);
req->acct.resp_hdrbytes += HTTP1_Write(req->wrk, req->resp, HTTP1_Resp);
if (req->res_mode & RES_CHUNKED)
V1L_Chunked(req->wrk);
ois = OIS_DONE;
if (!req->wantbody) {
/* This was a HEAD or conditional request */
} else if (req->esi_level > 0) {
if (req->gzip_resp &&
ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) &&
!(req->res_mode & RES_ESI)) {
if (bo != NULL)
VBO_waitstate(bo, BOS_FINISHED);
ESI_DeliverChild(req);
} else {
if (req->gzip_resp &&
!ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
VDP_push(req, VED_pretend_gzip, NULL);
else if (!req->gzip_resp &&
ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
VDP_push(req, VDP_gunzip, NULL);
if (req->res_mode & RES_ESI)
ESI_Deliver(req);
else
ois = v1d_WriteDirObj(req);
}
} else {
if (req->res_mode & RES_GUNZIP)
VDP_push(req, VDP_gunzip, NULL);
if (req->wantbody) {
if (req->res_mode & RES_ESI)
ESI_Deliver(req);
else
......@@ -372,13 +367,10 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
}
(void)VDP_bytes(req, VDP_FLUSH, NULL, 0);
if (ois == OIS_DONE &&
(req->res_mode & RES_CHUNKED) &&
!(req->res_mode & RES_ESI_CHILD))
if (ois == OIS_DONE && (req->res_mode & RES_CHUNKED))
V1L_EndChunk(req->wrk);
if ((V1L_FlushRelease(req->wrk) || ois != OIS_DONE) &&
req->sp->fd >= 0)
if ((V1L_FlushRelease(req->wrk) || ois != OIS_DONE) && req->sp->fd >= 0)
SES_Close(req->sp, SC_REM_CLOSE);
VDP_close(req);
}
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