Commit 94d1d0fd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Polish VDP stack mgt API

parent 69d45413
......@@ -52,7 +52,7 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)
}
void
VDP_push(struct req *req, vdp_bytes *func, void *priv)
VDP_push(struct req *req, vdp_bytes *func, void *priv, int bottom)
{
struct vdp_entry *vdp;
......@@ -64,8 +64,11 @@ VDP_push(struct req *req, vdp_bytes *func, void *priv)
INIT_OBJ(vdp, VDP_ENTRY_MAGIC);
vdp->func = func;
vdp->priv = priv;
VTAILQ_INSERT_HEAD(&req->vdp, vdp, list);
req->vdp_nxt = vdp;
if (bottom)
VTAILQ_INSERT_TAIL(&req->vdp, vdp, list);
else
VTAILQ_INSERT_HEAD(&req->vdp, vdp, list);
req->vdp_nxt = VTAILQ_FIRST(&req->vdp);
AZ(vdp->func(req, VDP_INIT, &vdp->priv, NULL, 0));
}
......
......@@ -127,10 +127,7 @@ ved_include(struct req *preq, const char *src, const char *host)
req->crc = preq->crc;
req->l_crc = preq->l_crc;
req->vdp_nxt = 0;
VTAILQ_INIT(&req->vdp);
VDP_push(req, ved_vdp_bytes, preq);
VDP_push(req, ved_vdp_bytes, preq, 0);
THR_SetRequest(req);
......
......@@ -106,7 +106,7 @@ struct vdp_entry {
};
int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len);
void VDP_push(struct req *, vdp_bytes *func, void *priv);
void VDP_push(struct req *, vdp_bytes *func, void *priv, int bottom);
void VDP_close(struct req *req);
vdp_bytes VDP_gunzip;
......
......@@ -371,6 +371,9 @@ SES_GetReq(const struct worker *wrk, struct sess *sp)
req->t_prev = NAN;
req->t_req = NAN;
req->vdp_nxt = 0;
VTAILQ_INIT(&req->vdp);
return (req);
}
......
......@@ -185,7 +185,7 @@ v1d_dorange(struct req *req, struct busyobj *bo, const char *r)
v1rp->range_off = 0;
v1rp->range_low = low;
v1rp->range_high = high + 1;
VDP_push(req, v1d_range_bytes, v1rp);
VDP_push(req, v1d_range_bytes, v1rp, 0);
}
/*--------------------------------------------------------------------*/
......@@ -308,10 +308,10 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
} else {
if (req->gzip_resp &&
!ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
VDP_push(req, VED_pretend_gzip, NULL);
VDP_push(req, VED_pretend_gzip, NULL, 0);
else if (!req->gzip_resp &&
ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED))
VDP_push(req, VDP_gunzip, NULL);
VDP_push(req, VDP_gunzip, NULL, 0);
if (req->res_mode & RES_ESI)
ESI_Deliver(req);
......@@ -335,10 +335,6 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
http_SetHeader(req->resp,
req->doclose ? "Connection: close" : "Connection: keep-alive");
req->vdp_nxt = 0;
VTAILQ_INIT(&req->vdp);
VDP_push(req, v1d_bytes, NULL);
if (
req->wantbody &&
cache_param->http_range_support &&
......@@ -349,7 +345,9 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
}
if (req->res_mode & RES_GUNZIP)
VDP_push(req, VDP_gunzip, NULL);
VDP_push(req, VDP_gunzip, NULL, 0);
VDP_push(req, v1d_bytes, NULL, 1);
V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev);
......
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