[experimental-ims] c0cf227 Another big wash of s/sp/req/ changes

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:49 CET 2014


commit c0cf227af98f8c74a26aee28f5d316cacaf11679
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jun 19 08:52:22 2012 +0000

    Another big wash of s/sp/req/ changes

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 03c3edf..845fac6 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -695,8 +695,8 @@ void VBE_UseHealth(const struct director *vdi);
 void VBE_DiscardHealth(const struct director *vdi);
 
 
-struct vbc *VDI_GetFd(const struct director *, struct sess *sp);
-int VDI_Healthy(const struct director *, const struct sess *sp);
+struct vbc *VDI_GetFd(const struct director *, struct req *);
+int VDI_Healthy(const struct director *, const struct req *);
 void VDI_CloseFd(struct vbc **vbp);
 void VDI_RecycleFd(struct vbc **vbp);
 void VDI_AddHostHeader(struct http *to, const struct vbc *vbc);
@@ -719,7 +719,7 @@ void BAN_Insert(struct ban *b);
 void BAN_Init(void);
 void BAN_NewObjCore(struct objcore *oc);
 void BAN_DestroyObj(struct objcore *oc);
-int BAN_CheckObject(struct object *o, const struct sess *sp);
+int BAN_CheckObject(struct object *o, struct req *sp);
 void BAN_Reload(const uint8_t *ban, unsigned len);
 struct ban *BAN_TailRef(void);
 void BAN_Compile(void);
@@ -766,9 +766,9 @@ int EXP_NukeOne(struct busyobj *, struct lru *lru);
 struct storage *FetchStorage(struct busyobj *, ssize_t sz);
 int FetchError(struct busyobj *, const char *error);
 int FetchError2(struct busyobj *, const char *error, const char *more);
-int FetchHdr(struct sess *sp, int need_host_hdr, int sendbody);
+int FetchHdr(struct req *req, int need_host_hdr, int sendbody);
 void FetchBody(struct worker *w, void *bo);
-int FetchReqBody(const struct sess *sp, int sendbody);
+int FetchReqBody(struct req *, int sendbody);
 void Fetch_Init(void);
 
 /* cache_gzip.c */
@@ -809,7 +809,7 @@ void http_ClrHeader(struct http *to);
 unsigned http_Write(const struct worker *w, const struct http *hp, int resp);
 void http_SetResp(struct http *to, const char *proto, uint16_t status,
     const char *response);
-void http_FilterReq(const struct sess *sp, unsigned how);
+void http_FilterReq(const struct req *, unsigned how);
 void http_FilterResp(const struct http *fm, struct http *to, unsigned how);
 void http_PutProtocol(const struct http *to, const char *protocol);
 void http_PutStatus(struct http *to, uint16_t status);
@@ -830,7 +830,7 @@ double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field);
 uint16_t http_GetStatus(const struct http *hp);
 const char *http_GetReq(const struct http *hp);
 int http_HdrIs(const struct http *hp, const char *hdr, const char *val);
-uint16_t http_DissectRequest(const struct sess *sp);
+uint16_t http_DissectRequest(struct req *);
 uint16_t http_DissectResponse(struct http *sp, const struct http_conn *htc);
 const char *http_DoConnection(const struct http *hp);
 void http_CopyHome(const struct http *hp);
@@ -954,8 +954,8 @@ void VSL_Flush(struct vsl_log *, int overflow);
 #endif
 
 /* cache_response.c */
-void RES_BuildHttp(const struct sess *sp);
-void RES_WriteObj(struct sess *sp);
+void RES_BuildHttp(struct req *);
+void RES_WriteObj(struct req *);
 
 /* cache_vary.c */
 struct vsb *VRY_Create(struct req *sp, const struct http *hp);
@@ -979,7 +979,7 @@ const char *VCL_Return_Name(unsigned method);
 char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap);
 char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
 
-void ESI_Deliver(struct sess *);
+void ESI_Deliver(struct req *);
 void ESI_DeliverChild(const struct sess *);
 
 /* cache_vrt_vmod.c */
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index fb116bf..e640a30 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -452,32 +452,32 @@ VBE_DiscardHealth(const struct director *vdi)
  */
 
 static struct vbc * __match_proto__(vdi_getfd_f)
-vdi_simple_getfd(const struct director *d, struct sess *sp)
+vdi_simple_getfd(const struct director *d, struct req *req)
 {
 	struct vdi_simple *vs;
 	struct vbc *vc;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
-	vc = vbe_GetVbe(sp, vs);
+	vc = vbe_GetVbe(req->sp, vs);
 	if (vc != NULL) {
 		FIND_TMO(first_byte_timeout,
-		    vc->first_byte_timeout, sp, vs->vrt);
+		    vc->first_byte_timeout, req->sp, vs->vrt);
 		FIND_TMO(between_bytes_timeout,
-		    vc->between_bytes_timeout, sp, vs->vrt);
+		    vc->between_bytes_timeout, req->sp, vs->vrt);
 	}
 	return (vc);
 }
 
 static unsigned
-vdi_simple_healthy(const struct director *d, const struct sess *sp)
+vdi_simple_healthy(const struct director *d, const struct req *req)
 {
 	struct vdi_simple *vs;
 
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
-	return (vbe_Healthy(vs, sp));
+	return (vbe_Healthy(vs, req->sp));
 }
 
 static void
diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h
index 96f0a63..3baa0ca 100644
--- a/bin/varnishd/cache/cache_backend.h
+++ b/bin/varnishd/cache/cache_backend.h
@@ -75,9 +75,9 @@ struct vrt_backend_probe;
  * backends to use.
  */
 
-typedef struct vbc *vdi_getfd_f(const struct director *, struct sess *sp);
+typedef struct vbc *vdi_getfd_f(const struct director *, struct req *);
 typedef void vdi_fini_f(const struct director *);
-typedef unsigned vdi_healthy(const struct director *, const struct sess *sp);
+typedef unsigned vdi_healthy(const struct director *, const struct req *);
 
 struct director {
 	unsigned		magic;
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 6986d21..be8af1a 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -765,10 +765,10 @@ ban_check_object(struct object *o, struct vsl_log *vsl,
 }
 
 int
-BAN_CheckObject(struct object *o, const struct sess *sp)
+BAN_CheckObject(struct object *o, struct req *req)
 {
 
-	return (ban_check_object(o, sp->req->vsl, sp->req->http) > 0);
+	return (ban_check_object(o, req->vsl, req->http) > 0);
 }
 
 static struct ban *
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 729b91b..240d0d0 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -265,7 +265,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
 			req->obj->last_use = req->t_resp; /* XXX: locking ? */
 	}
 	HTTP_Setup(req->resp, req->ws, req->vsl, HTTP_Resp);
-	RES_BuildHttp(sp);
+	RES_BuildHttp(req);
 
 	assert(req->sp == sp);
 	VCL_deliver_method(req);
@@ -340,7 +340,7 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
 	req->director = NULL;
 	req->restarts = 0;
 
-	RES_WriteObj(sp);
+	RES_WriteObj(req);
 
 	/* No point in saving the body if it is hit-for-pass */
 	if (req->obj->objcore->flags & OC_F_PASS)
@@ -591,7 +591,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
 
 	wrk->acct_tmp.fetch++;
 
-	i = FetchHdr(sp, need_host_hdr, req->objcore->objhead == NULL);
+	i = FetchHdr(req, need_host_hdr, req->objcore->objhead == NULL);
 	/*
 	 * If we recycle a backend connection, there is a finite chance
 	 * that the backend closed it before we get a request to it.
@@ -599,7 +599,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
 	 */
 	if (i == 1) {
 		VSC_C_main->backend_retry++;
-		i = FetchHdr(sp, need_host_hdr, req->objcore->objhead == NULL);
+		i = FetchHdr(req, need_host_hdr, req->objcore->objhead == NULL);
 	}
 
 	if (i) {
@@ -1016,7 +1016,7 @@ cnt_hit(struct sess *sp, struct worker *wrk, struct req *req)
 	if (req->handling == VCL_RET_DELIVER) {
 		//AZ(req->busyobj->bereq->ws);
 		//AZ(req->busyobj->beresp->ws);
-		(void)FetchReqBody(sp, 0);
+		(void)FetchReqBody(req, 0);
 		sp->step = STP_PREPRESP;
 		return (0);
 	}
@@ -1173,7 +1173,7 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
 	AZ(req->obj);
 
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
-	http_FilterReq(sp, HTTPH_R_FETCH);
+	http_FilterReq(req, HTTPH_R_FETCH);
 	http_ForceGet(bo->bereq);
 	if (cache_param->http_gzip_support) {
 		/*
@@ -1251,7 +1251,7 @@ cnt_pass(struct sess *sp, struct worker *wrk, struct req *req)
 	bo->vsl->wid = sp->vsl_id;
 	bo->refcount = 2;
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
-	http_FilterReq(sp, HTTPH_R_PASS);
+	http_FilterReq(req, HTTPH_R_PASS);
 
 	assert(req->sp == sp);
 	VCL_pass_method(req);
@@ -1313,7 +1313,7 @@ cnt_pipe(struct sess *sp, struct worker *wrk, struct req *req)
 	bo = req->busyobj;
 	bo->vsl->wid = sp->vsl_id;
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
-	http_FilterReq(sp, 0);
+	http_FilterReq(req, 0);
 
 	assert(req->sp == sp);
 	VCL_pipe_method(req);
@@ -1514,7 +1514,7 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req)
 	EXP_Clr(&req->exp);
 
 	HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Req);
-	req->err_code = http_DissectRequest(sp);
+	req->err_code = http_DissectRequest(req);
 
 	/* If we could not even parse the request, just close */
 	if (req->err_code == 400) {
diff --git a/bin/varnishd/cache/cache_dir.c b/bin/varnishd/cache/cache_dir.c
index 6dda80d..528a57c 100644
--- a/bin/varnishd/cache/cache_dir.c
+++ b/bin/varnishd/cache/cache_dir.c
@@ -105,17 +105,17 @@ VDI_RecycleFd(struct vbc **vbp)
 /* Get a connection --------------------------------------------------*/
 
 struct vbc *
-VDI_GetFd(const struct director *d, struct sess *sp)
+VDI_GetFd(const struct director *d, struct req *req)
 {
 	struct vbc *vc;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	if (d == NULL)
-		d = sp->req->director;
+		d = req->director;
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
-	vc = d->getfd(d, sp);
+	vc = d->getfd(d, req);
 	if (vc != NULL) {
-		vc->vsl = sp->req->busyobj->vsl;
+		vc->vsl = req->busyobj->vsl;
 		vc->orig_vsl_id = vc->vsl->wid;
 		vc->vsl->wid = vc->vsl_id;
 	}
@@ -130,10 +130,10 @@ VDI_GetFd(const struct director *d, struct sess *sp)
  */
 
 int
-VDI_Healthy(const struct director *d, const struct sess *sp)
+VDI_Healthy(const struct director *d, const struct req *req)
 {
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
-	return (d->healthy(d, sp));
+	return (d->healthy(d, req));
 }
diff --git a/bin/varnishd/cache/cache_dir_dns.c b/bin/varnishd/cache/cache_dir_dns.c
index 068c2b9..e947f61 100644
--- a/bin/varnishd/cache/cache_dir_dns.c
+++ b/bin/varnishd/cache/cache_dir_dns.c
@@ -150,7 +150,7 @@ vdi_dns_pick_host(const struct sess *sp, struct vdi_dns_hostgroup *group) {
 			current = i + initial - nhosts;
 		else
 			current = i + initial;
-		if (VDI_Healthy(group->hosts[current], sp)) {
+		if (VDI_Healthy(group->hosts[current], sp->req)) {
 			group->next_host = current+1;
 			return (group->hosts[current]);
 		}
@@ -372,31 +372,31 @@ vdi_dns_find_backend(const struct sess *sp, struct vdi_dns *vs)
 }
 
 static struct vbc *
-vdi_dns_getfd(const struct director *director, struct sess *sp)
+vdi_dns_getfd(const struct director *director, struct req *req)
 {
 	struct vdi_dns *vs;
 	struct director *dir;
 	struct vbc *vbe;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(director, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, director->priv, VDI_DNS_MAGIC);
 
-	dir = vdi_dns_find_backend(sp, vs);
-	if (!dir || !VDI_Healthy(dir, sp))
+	dir = vdi_dns_find_backend(req->sp, vs);
+	if (!dir || !VDI_Healthy(dir, req))
 		return (NULL);
 
-	vbe = VDI_GetFd(dir, sp);
+	vbe = VDI_GetFd(dir, req);
 	return (vbe);
 }
 
 static unsigned
-vdi_dns_healthy(const struct director *dir, const struct sess *sp)
+vdi_dns_healthy(const struct director *dir, const struct req *req)
 {
 	/* XXX: Fooling -Werror for a bit until it's actually implemented.
 	 */
 	(void)dir;
-	(void)sp;
+	(void)req;
 	return (1);
 
 	/*
@@ -404,11 +404,11 @@ vdi_dns_healthy(const struct director *dir, const struct sess *sp)
 	struct director *dir;
 	int i;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	CHECK_OBJ_NOTNULL(sp->req->director, DIRECTOR_MAGIC);
-	CAST_OBJ_NOTNULL(vs, sp->req->director->priv, VDI_DNS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	CHECK_OBJ_NOTNULL(req->director, DIRECTOR_MAGIC);
+	CAST_OBJ_NOTNULL(vs, req->director->priv, VDI_DNS_MAGIC);
 
-	dir = vdi_dns_find_backend(sp, vs);
+	dir = vdi_dns_find_backend(req->sp, vs);
 
 	if (dir)
 		return (1);
diff --git a/bin/varnishd/cache/cache_dir_random.c b/bin/varnishd/cache/cache_dir_random.c
index 8a0bcd2..c291fe0 100644
--- a/bin/varnishd/cache/cache_dir_random.c
+++ b/bin/varnishd/cache/cache_dir_random.c
@@ -98,22 +98,22 @@ vdi_random_sha(const char *input, ssize_t len)
  * Sets up the initial seed for picking a backend according to policy.
  */
 static double
-vdi_random_init_seed(const struct vdi_random *vs, const struct sess *sp)
+vdi_random_init_seed(const struct vdi_random *vs, const struct req *req)
 {
 	const char *p;
 	double retval;
 
 	switch (vs->criteria) {
 	case c_client:
-		if (sp->req->client_identity != NULL)
-			p = sp->req->client_identity;
+		if (req->client_identity != NULL)
+			p = req->client_identity;
 		else
-			p = sp->addr;
+			p = req->sp->addr;
 		retval = vdi_random_sha(p, strlen(p));
 		break;
 	case c_hash:
-		AN(sp->req->digest);
-		retval = scalbn(vle32dec(sp->req->digest), -32);
+		AN(req->digest);
+		retval = scalbn(vle32dec(req->digest), -32);
 		break;
 	case c_random:
 	default:
@@ -127,7 +127,7 @@ vdi_random_init_seed(const struct vdi_random *vs, const struct sess *sp)
  * Find the healthy backend corresponding to the weight r [0...1[
  */
 static struct vbc *
-vdi_random_pick_one(struct sess *sp, const struct vdi_random *vs, double r,
+vdi_random_pick_one(struct req *req, const struct vdi_random *vs, double r,
     int retries)
 {
 	double w[vs->nhosts];
@@ -154,9 +154,9 @@ vdi_random_pick_one(struct sess *sp, const struct vdi_random *vs, double r,
 			s2 += w[i];
 			if (r >= s2)
 				continue;
-			if (!VDI_Healthy(vs->hosts[i].backend, sp))
+			if (!VDI_Healthy(vs->hosts[i].backend, req))
 				break;
-			vbc = VDI_GetFd(vs->hosts[i].backend, sp);
+			vbc = VDI_GetFd(vs->hosts[i].backend, req);
 			if (vbc == NULL)
 				break;
 			return (vbc);
@@ -181,18 +181,18 @@ vdi_random_pick_one(struct sess *sp, const struct vdi_random *vs, double r,
  * random by rehashing the key.
  */
 static struct vbc *
-vdi_random_getfd(const struct director *d, struct sess *sp)
+vdi_random_getfd(const struct director *d, struct req *req)
 {
 	struct vdi_random *vs;
 	double r;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_RANDOM_MAGIC);
 
-	r = vdi_random_init_seed(vs, sp);
+	r = vdi_random_init_seed(vs, req);
 
-	return (vdi_random_pick_one(sp, vs, r, vs->retries));
+	return (vdi_random_pick_one(req, vs, r, vs->retries));
 }
 
 /*
@@ -200,7 +200,7 @@ vdi_random_getfd(const struct director *d, struct sess *sp)
  * XXX: we should really have a weight param/criteria here
  */
 static unsigned
-vdi_random_healthy(const struct director *d, const struct sess *sp)
+vdi_random_healthy(const struct director *d, const struct req *req)
 {
 	struct vdi_random *vs;
 	int i;
@@ -209,7 +209,7 @@ vdi_random_healthy(const struct director *d, const struct sess *sp)
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_RANDOM_MAGIC);
 
 	for (i = 0; i < vs->nhosts; i++) {
-		if (VDI_Healthy(vs->hosts[i].backend, sp))
+		if (VDI_Healthy(vs->hosts[i].backend, req))
 			return (1);
 	}
 	return (0);
diff --git a/bin/varnishd/cache/cache_dir_round_robin.c b/bin/varnishd/cache/cache_dir_round_robin.c
index 350f18c..68e7071 100644
--- a/bin/varnishd/cache/cache_dir_round_robin.c
+++ b/bin/varnishd/cache/cache_dir_round_robin.c
@@ -55,14 +55,14 @@ struct vdi_round_robin {
 };
 
 static struct vbc *
-vdi_round_robin_getfd(const struct director *d, struct sess *sp)
+vdi_round_robin_getfd(const struct director *d, struct req *req)
 {
 	int i;
 	struct vdi_round_robin *vs;
 	struct director *backend;
 	struct vbc *vbe;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_ROUND_ROBIN_MAGIC);
 
@@ -77,9 +77,9 @@ vdi_round_robin_getfd(const struct director *d, struct sess *sp)
 		} else /* m_fallback */ {
 			backend = vs->hosts[i].backend;
 		}
-		if (!VDI_Healthy(backend, sp))
+		if (!VDI_Healthy(backend, req))
 			continue;
-		vbe = VDI_GetFd(backend, sp);
+		vbe = VDI_GetFd(backend, req);
 		if (vbe != NULL)
 			return (vbe);
 	}
@@ -88,7 +88,7 @@ vdi_round_robin_getfd(const struct director *d, struct sess *sp)
 }
 
 static unsigned
-vdi_round_robin_healthy(const struct director *d, const struct sess *sp)
+vdi_round_robin_healthy(const struct director *d, const struct req *req)
 {
 	struct vdi_round_robin *vs;
 	struct director *backend;
@@ -99,7 +99,7 @@ vdi_round_robin_healthy(const struct director *d, const struct sess *sp)
 
 	for (i = 0; i < vs->nhosts; i++) {
 		backend = vs->hosts[i].backend;
-		if (VDI_Healthy(backend, sp))
+		if (VDI_Healthy(backend, req))
 			return (1);
 	}
 	return (0);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 73aac72..9199d67 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -42,7 +42,7 @@
 /*--------------------------------------------------------------------*/
 
 static void
-ved_include(struct sess *sp, const char *src, const char *host)
+ved_include(struct req *req, const char *src, const char *host)
 {
 	struct object *obj;
 	struct worker *wrk;
@@ -50,71 +50,71 @@ ved_include(struct sess *sp, const char *src, const char *host)
 	char *wrk_ws_wm;
 	unsigned sxid, res_mode;
 
-	wrk = sp->wrk;
+	wrk = req->sp->wrk;
 
-	if (sp->req->esi_level >= cache_param->max_esi_depth)
+	if (req->esi_level >= cache_param->max_esi_depth)
 		return;
-	sp->req->esi_level++;
+	req->esi_level++;
 
 	(void)WRW_FlushRelease(wrk);
 
-	obj = sp->req->obj;
-	sp->req->obj = NULL;
-	res_mode = sp->req->res_mode;
+	obj = req->obj;
+	req->obj = NULL;
+	res_mode = req->res_mode;
 
 	/* Reset request to status before we started messing with it */
-	HTTP_Copy(sp->req->http, sp->req->http0);
+	HTTP_Copy(req->http, req->http0);
 
 	/* Take a workspace snapshot */
-	sp_ws_wm = WS_Snapshot(sp->req->ws);
+	sp_ws_wm = WS_Snapshot(req->ws);
 	wrk_ws_wm = WS_Snapshot(wrk->aws); /* XXX ? */
 
-	http_SetH(sp->req->http, HTTP_HDR_URL, src);
+	http_SetH(req->http, HTTP_HDR_URL, src);
 	if (host != NULL && *host != '\0')  {
-		http_Unset(sp->req->http, H_Host);
-		http_Unset(sp->req->http, H_If_Modified_Since);
-		http_SetHeader(sp->req->http, host);
+		http_Unset(req->http, H_Host);
+		http_Unset(req->http, H_If_Modified_Since);
+		http_SetHeader(req->http, host);
 	}
 	/*
 	 * XXX: We should decide if we should cache the director
 	 * XXX: or not (for session/backend coupling).  Until then
 	 * XXX: make sure we don't trip up the check in vcl_recv.
 	 */
-	sp->req->director = NULL;
-	sp->step = STP_RECV;
-	http_ForceGet(sp->req->http);
+	req->director = NULL;
+	req->sp->step = STP_RECV;
+	http_ForceGet(req->http);
 
 	/* Don't do conditionals */
-	sp->req->http->conds = 0;
-	http_Unset(sp->req->http, H_If_Modified_Since);
+	req->http->conds = 0;
+	http_Unset(req->http, H_If_Modified_Since);
 
 	/* Client content already taken care of */
-	http_Unset(sp->req->http, H_Content_Length);
+	http_Unset(req->http, H_Content_Length);
 
-	sxid = sp->req->xid;
+	sxid = req->xid;
 	while (1) {
-		sp->wrk = wrk;
-		CNT_Session(sp);
-		if (sp->step == STP_DONE)
+		req->sp->wrk = wrk;
+		CNT_Session(req->sp);
+		if (req->sp->step == STP_DONE)
 			break;
-		AZ(sp->wrk);
-		DSL(0x20, SLT_Debug, sp->vsl_id, "loop waiting for ESI");
+		AZ(req->sp->wrk);
+		DSL(0x20, SLT_Debug, req->sp->vsl_id, "loop waiting for ESI");
 		(void)usleep(10000);
 	}
-	sp->req->xid = sxid;
-	AN(sp->wrk);
-	assert(sp->step == STP_DONE);
-	sp->req->esi_level--;
-	sp->req->obj = obj;
-	sp->req->res_mode = res_mode;
+	req->xid = sxid;
+	AN(req->sp->wrk);
+	assert(req->sp->step == STP_DONE);
+	req->esi_level--;
+	req->obj = obj;
+	req->res_mode = res_mode;
 
 	/* Reset the workspace */
-	WS_Reset(sp->req->ws, sp_ws_wm);
+	WS_Reset(req->ws, sp_ws_wm);
 	WS_Reset(wrk->aws, wrk_ws_wm);	/* XXX ? */
 
-	WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
-	if (sp->req->res_mode & RES_CHUNKED)
-		WRW_Chunked(sp->wrk);
+	WRW_Reserve(req->sp->wrk, &req->sp->fd, req->vsl, req->t_resp);
+	if (req->res_mode & RES_CHUNKED)
+		WRW_Chunked(req->sp->wrk);
 }
 
 /*--------------------------------------------------------------------*/
@@ -171,7 +171,7 @@ ved_decode_len(uint8_t **pp)
  */
 
 static void
-ved_pretend_gzip(const struct sess *sp, const uint8_t *p, ssize_t l)
+ved_pretend_gzip(struct req *req, const uint8_t *p, ssize_t l)
 {
 	uint8_t buf1[5], buf2[5];
 	uint16_t lx;
@@ -184,22 +184,22 @@ ved_pretend_gzip(const struct sess *sp, const uint8_t *p, ssize_t l)
 	while (l > 0) {
 		if (l >= 65535) {
 			lx = 65535;
-			(void)WRW_Write(sp->wrk, buf1, sizeof buf1);
+			(void)WRW_Write(req->sp->wrk, buf1, sizeof buf1);
 		} else {
 			lx = (uint16_t)l;
 			buf2[0] = 0;
 			vle16enc(buf2 + 1, lx);
 			vle16enc(buf2 + 3, ~lx);
-			(void)WRW_Write(sp->wrk, buf2, sizeof buf2);
+			(void)WRW_Write(req->sp->wrk, buf2, sizeof buf2);
 		}
-		(void)WRW_Write(sp->wrk, p, lx);
-		sp->req->crc = crc32(sp->req->crc, p, lx);
-		sp->req->l_crc += lx;
+		(void)WRW_Write(req->sp->wrk, p, lx);
+		req->crc = crc32(req->crc, p, lx);
+		req->l_crc += lx;
 		l -= lx;
 		p += lx;
 	}
 	/* buf2 is local, have to flush */
-	(void)WRW_Flush(sp->wrk);
+	(void)WRW_Flush(req->sp->wrk);
 }
 
 /*---------------------------------------------------------------------
@@ -213,7 +213,7 @@ static const uint8_t gzip_hdr[] = {
 };
 
 void
-ESI_Deliver(struct sess *sp)
+ESI_Deliver(struct req *req)
 {
 	struct storage *st;
 	uint8_t *p, *e, *q, *r;
@@ -227,8 +227,8 @@ ESI_Deliver(struct sess *sp)
 	const void *dp;
 	int i;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	st = sp->req->obj->esidata;
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	st = req->obj->esidata;
 	AN(st);
 
 	p = st->ptr;
@@ -241,23 +241,23 @@ ESI_Deliver(struct sess *sp)
 		isgzip = 0;
 	}
 
-	if (sp->req->esi_level == 0) {
+	if (req->esi_level == 0) {
 		/*
 		 * Only the top level document gets to decide this.
 		 */
-		sp->req->gzip_resp = 0;
-		if (isgzip && !(sp->req->res_mode & RES_GUNZIP)) {
+		req->gzip_resp = 0;
+		if (isgzip && !(req->res_mode & RES_GUNZIP)) {
 			assert(sizeof gzip_hdr == 10);
 			/* Send out the gzip header */
-			(void)WRW_Write(sp->wrk, gzip_hdr, 10);
-			sp->req->l_crc = 0;
-			sp->req->gzip_resp = 1;
-			sp->req->crc = crc32(0L, Z_NULL, 0);
+			(void)WRW_Write(req->sp->wrk, gzip_hdr, 10);
+			req->l_crc = 0;
+			req->gzip_resp = 1;
+			req->crc = crc32(0L, Z_NULL, 0);
 		}
 	}
 
-	if (isgzip && !sp->req->gzip_resp) {
-		vgz = VGZ_NewUngzip(sp->req->vsl, "U D E");
+	if (isgzip && !req->gzip_resp) {
+		vgz = VGZ_NewUngzip(req->vsl, "U D E");
 		AZ(VGZ_WrwInit(vgz));
 
 		/* Feed a gzip header to gunzip to make it happy */
@@ -268,7 +268,7 @@ ESI_Deliver(struct sess *sp)
 		assert(dl == 0);
 	}
 
-	st = VTAILQ_FIRST(&sp->req->obj->store);
+	st = VTAILQ_FIRST(&req->obj->store);
 	off = 0;
 
 	while (p < e) {
@@ -283,10 +283,10 @@ ESI_Deliver(struct sess *sp)
 				l_icrc = ved_decode_len(&p);
 				icrc = vbe32dec(p);
 				p += 4;
-				if (sp->req->gzip_resp) {
-					sp->req->crc = crc32_combine(
-					    sp->req->crc, icrc, l_icrc);
-					sp->req->l_crc += l_icrc;
+				if (req->gzip_resp) {
+					req->crc = crc32_combine(
+					    req->crc, icrc, l_icrc);
+					req->l_crc += l_icrc;
 				}
 			}
 			/*
@@ -300,29 +300,31 @@ ESI_Deliver(struct sess *sp)
 					l2 = st->len - off;
 				l -= l2;
 
-				if (sp->req->gzip_resp && isgzip) {
+				if (req->gzip_resp && isgzip) {
 					/*
 					 * We have a gzip'ed VEC and delivers
 					 * a gzip'ed ESI response.
 					 */
-					(void)WRW_Write(sp->wrk,
+					(void)WRW_Write(req->sp->wrk,
 					    st->ptr + off, l2);
-				} else if (sp->req->gzip_resp) {
+				} else if (req->gzip_resp) {
 					/*
 					 * A gzip'ed ESI response, but the VEC
 					 * was not gzip'ed.
 					 */
-					ved_pretend_gzip(sp, st->ptr + off, l2);
+					ved_pretend_gzip(req,
+					    st->ptr + off, l2);
 				} else if (isgzip) {
 					/*
 					 * A gzip'ed VEC, but ungzip'ed ESI
 					 * response
 					 */
 					AN(vgz);
-					i = VGZ_WrwGunzip(sp->wrk, vgz,
+					i = VGZ_WrwGunzip(req->sp->wrk, vgz,
 						st->ptr + off, l2);
-					if (WRW_Error(sp->wrk)) {
-						SES_Close(sp, "remote closed");
+					if (WRW_Error(req->sp->wrk)) {
+						SES_Close(req->sp,
+						    "remote closed");
 						p = e;
 						break;
 					}
@@ -331,7 +333,7 @@ ESI_Deliver(struct sess *sp)
 					/*
 					 * Ungzip'ed VEC, ungzip'ed ESI response
 					 */
-					(void)WRW_Write(sp->wrk,
+					(void)WRW_Write(req->sp->wrk,
 					    st->ptr + off, l2);
 				}
 				off += l2;
@@ -371,14 +373,14 @@ ESI_Deliver(struct sess *sp)
 			r = (void*)strchr((const char*)q, '\0');
 			AN(r);
 			if (vgz != NULL)
-				VGZ_WrwFlush(sp->wrk, vgz);
-			if (WRW_Flush(sp->wrk)) {
-				SES_Close(sp, "remote closed");
+				VGZ_WrwFlush(req->sp->wrk, vgz);
+			if (WRW_Flush(req->sp->wrk)) {
+				SES_Close(req->sp, "remote closed");
 				p = e;
 				break;
 			}
 			Debug("INCL [%s][%s] BEGIN\n", q, p);
-			ved_include(sp, (const char*)q, (const char*)p);
+			ved_include(req, (const char*)q, (const char*)p);
 			Debug("INCL [%s][%s] END\n", q, p);
 			p = r + 1;
 			break;
@@ -388,10 +390,10 @@ ESI_Deliver(struct sess *sp)
 		}
 	}
 	if (vgz != NULL) {
-		VGZ_WrwFlush(sp->wrk, vgz);
+		VGZ_WrwFlush(req->sp->wrk, vgz);
 		(void)VGZ_Destroy(&vgz);
 	}
-	if (sp->req->gzip_resp && sp->req->esi_level == 0) {
+	if (req->gzip_resp && req->esi_level == 0) {
 		/* Emit a gzip literal block with finish bit set */
 		tailbuf[0] = 0x01;
 		tailbuf[1] = 0x00;
@@ -400,14 +402,14 @@ ESI_Deliver(struct sess *sp)
 		tailbuf[4] = 0xff;
 
 		/* Emit CRC32 */
-		vle32enc(tailbuf + 5, sp->req->crc);
+		vle32enc(tailbuf + 5, req->crc);
 
 		/* MOD(2^32) length */
-		vle32enc(tailbuf + 9, sp->req->l_crc);
+		vle32enc(tailbuf + 9, req->l_crc);
 
-		(void)WRW_Write(sp->wrk, tailbuf, 13);
+		(void)WRW_Write(req->sp->wrk, tailbuf, 13);
 	}
-	(void)WRW_Flush(sp->wrk);
+	(void)WRW_Flush(req->sp->wrk);
 }
 
 /*---------------------------------------------------------------------
@@ -464,7 +466,7 @@ ESI_DeliverChild(const struct sess *sp)
 
 	if (!sp->req->obj->gziped) {
 		VTAILQ_FOREACH(st, &sp->req->obj->store, list)
-			ved_pretend_gzip(sp, st->ptr, st->len);
+			ved_pretend_gzip(sp->req, st->ptr, st->len);
 		return;
 	}
 	/*
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 7ccba0a..129a0a7 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -378,20 +378,20 @@ fetch_eof(struct busyobj *bo, struct http_conn *htc)
  */
 
 int
-FetchReqBody(const struct sess *sp, int sendbody)
+FetchReqBody(struct req *req, int sendbody)
 {
 	unsigned long content_length;
 	char buf[8192];
 	char *ptr, *endp;
 	int rdcnt;
 
-	if (sp->req->reqbodydone) {
+	if (req->reqbodydone) {
 		AZ(sendbody);
 		return (0);
 	}
 
-	if (http_GetHdr(sp->req->http, H_Content_Length, &ptr)) {
-		sp->req->reqbodydone = 1;
+	if (http_GetHdr(req->http, H_Content_Length, &ptr)) {
+		req->reqbodydone = 1;
 
 		content_length = strtoul(ptr, &endp, 10);
 		/* XXX should check result of conversion */
@@ -400,21 +400,21 @@ FetchReqBody(const struct sess *sp, int sendbody)
 				rdcnt = sizeof buf;
 			else
 				rdcnt = content_length;
-			rdcnt = HTC_Read(sp->req->htc, buf, rdcnt);
+			rdcnt = HTC_Read(req->htc, buf, rdcnt);
 			if (rdcnt <= 0)
 				return (1);
 			content_length -= rdcnt;
 			if (sendbody) {
 				/* XXX: stats ? */
-				(void)WRW_Write(sp->wrk, buf, rdcnt);
-				if (WRW_Flush(sp->wrk))
+				(void)WRW_Write(req->sp->wrk, buf, rdcnt);
+				if (WRW_Flush(req->sp->wrk))
 					return (2);
 			}
 		}
 	}
-	if (http_GetHdr(sp->req->http, H_Transfer_Encoding, NULL)) {
+	if (http_GetHdr(req->http, H_Transfer_Encoding, NULL)) {
 		/* XXX: Handle chunked encoding. */
-		VSLb(sp->req->vsl, SLT_Debug, "Transfer-Encoding in request");
+		VSLb(req->vsl, SLT_Debug, "Transfer-Encoding in request");
 		return (1);
 	}
 	return (0);
@@ -431,20 +431,18 @@ FetchReqBody(const struct sess *sp, int sendbody)
  */
 
 int
-FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
+FetchHdr(struct req *req, int need_host_hdr, int sendbody)
 {
 	struct vbc *vc;
 	struct worker *wrk;
-	struct req *req;
 	struct busyobj *bo;
 	struct http *hp;
 	int retry = -1;
 	int i;
 	struct http_conn *htc;
 
-	wrk = sp->wrk;
+	wrk = req->sp->wrk;
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	req = sp->req;
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	bo = req->busyobj;
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -458,7 +456,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
 
 	hp = bo->bereq;
 
-	bo->vbc = VDI_GetFd(NULL, sp);
+	bo->vbc = VDI_GetFd(NULL, req);
 	if (bo->vbc == NULL) {
 		VSLb(req->vsl, SLT_FetchError, "no backend connection");
 		return (-1);
@@ -480,7 +478,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
 	(void)http_Write(wrk, hp, 0);	/* XXX: stats ? */
 
 	/* Deal with any message-body the request might have */
-	i = FetchReqBody(sp, sendbody);
+	i = FetchReqBody(req, sendbody);
 	if (WRW_FlushRelease(wrk) || i > 0) {
 		VSLb(req->vsl, SLT_FetchError,
 		    "backend write error: %d (%s)",
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index bfb030d..f2d5be3 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -358,7 +358,7 @@ HSH_Lookup(struct sess *sp)
 
 		if (o->exp.ttl <= 0.)
 			continue;
-		if (BAN_CheckObject(o, sp))
+		if (BAN_CheckObject(o, req))
 			continue;
 		if (o->vary != NULL && !VRY_Match(req, o->vary))
 			continue;
@@ -391,7 +391,7 @@ HSH_Lookup(struct sess *sp)
 	if (oc == NULL			/* We found no live object */
 	    && grace_oc != NULL		/* There is a grace candidate */
 	    && (busy_found		/* Somebody else is already busy */
-	    || !VDI_Healthy(req->director, sp))) {
+	    || !VDI_Healthy(req->director, req))) {
 					/* Or it is impossible to fetch */
 		o = oc_getobj(&wrk->stats, grace_oc);
 		CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 0380469..411b2d3 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -651,22 +651,22 @@ http_ProtoVer(struct http *hp)
 /*--------------------------------------------------------------------*/
 
 uint16_t
-http_DissectRequest(const struct sess *sp)
+http_DissectRequest(struct req *req)
 {
 	struct http_conn *htc;
 	struct http *hp;
 	uint16_t retval;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	htc = sp->req->htc;
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	htc = req->htc;
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
-	hp = sp->req->http;
+	hp = req->http;
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 
 	retval = http_splitline(hp, htc,
 	    HTTP_HDR_REQ, HTTP_HDR_URL, HTTP_HDR_PROTO);
 	if (retval != 0) {
-		VSLbt(sp->req->vsl, SLT_HttpGarbage, htc->rxbuf);
+		VSLbt(req->vsl, SLT_HttpGarbage, htc->rxbuf);
 		return (retval);
 	}
 	http_ProtoVer(hp);
@@ -838,21 +838,21 @@ http_filterfields(struct http *to, const struct http *fm, unsigned how)
 /*--------------------------------------------------------------------*/
 
 void
-http_FilterReq(const struct sess *sp, unsigned how)
+http_FilterReq(const struct req *req, unsigned how)
 {
 	struct http *hp;
 
-	hp = sp->req->busyobj->bereq;
+	hp = req->busyobj->bereq;
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 
-	http_linkh(hp, sp->req->http, HTTP_HDR_REQ);
-	http_linkh(hp, sp->req->http, HTTP_HDR_URL);
+	http_linkh(hp, req->http, HTTP_HDR_REQ);
+	http_linkh(hp, req->http, HTTP_HDR_URL);
 	if (how == HTTPH_R_FETCH)
 		http_SetH(hp, HTTP_HDR_PROTO, "HTTP/1.1");
 	else
-		http_linkh(hp, sp->req->http, HTTP_HDR_PROTO);
-	http_filterfields(hp, sp->req->http, how);
-	http_PrintfHeader(hp, "X-Varnish: %u", sp->req->xid);
+		http_linkh(hp, req->http, HTTP_HDR_PROTO);
+	http_filterfields(hp, req->http, how);
+	http_PrintfHeader(hp, "X-Varnish: %u", req->xid);
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c
index fda21f4..77ffcda 100644
--- a/bin/varnishd/cache/cache_pipe.c
+++ b/bin/varnishd/cache/cache_pipe.c
@@ -74,7 +74,7 @@ PipeSession(struct sess *sp)
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	wrk = sp->wrk;
 
-	vc = VDI_GetFd(NULL, sp);
+	vc = VDI_GetFd(NULL, sp->req);
 	if (vc == NULL)
 		return;
 	bo->vbc = vc;		/* For panic dumping */
diff --git a/bin/varnishd/cache/cache_response.c b/bin/varnishd/cache/cache_response.c
index 700e791..59aa6cb 100644
--- a/bin/varnishd/cache/cache_response.c
+++ b/bin/varnishd/cache/cache_response.c
@@ -37,12 +37,10 @@
 /*--------------------------------------------------------------------*/
 
 static void
-res_dorange(const struct sess *sp, const char *r, ssize_t *plow, ssize_t *phigh)
+res_dorange(const struct req *req, const char *r, ssize_t *plow, ssize_t *phigh)
 {
 	ssize_t low, high, has_low;
-	struct req *req;
 
-	req = sp->req;
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	assert(req->obj->response == 200);
 	if (strncmp(r, "bytes=", 6))
@@ -105,13 +103,10 @@ res_dorange(const struct sess *sp, const char *r, ssize_t *plow, ssize_t *phigh)
 /*--------------------------------------------------------------------*/
 
 void
-RES_BuildHttp(const struct sess *sp)
+RES_BuildHttp(struct req *req)
 {
 	char time_str[30];
-	struct req *req;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	req = sp->req;
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
 	http_ClrHeader(req->resp);
@@ -188,17 +183,17 @@ res_WriteGunzipObj(const struct sess *sp)
 /*--------------------------------------------------------------------*/
 
 static void
-res_WriteDirObj(const struct sess *sp, ssize_t low, ssize_t high)
+res_WriteDirObj(const struct req *req, ssize_t low, ssize_t high)
 {
 	ssize_t u = 0;
 	size_t ptr, off, len;
 	struct storage *st;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
 	ptr = 0;
-	VTAILQ_FOREACH(st, &sp->req->obj->store, list) {
-		CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	VTAILQ_FOREACH(st, &req->obj->store, list) {
+		CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 		CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
 		u += st->len;
 		len = st->len;
@@ -220,10 +215,10 @@ res_WriteDirObj(const struct sess *sp, ssize_t low, ssize_t high)
 
 		ptr += len;
 
-		sp->wrk->acct_tmp.bodybytes += len;
-		(void)WRW_Write(sp->wrk, st->ptr + off, len);
+		req->sp->wrk->acct_tmp.bodybytes += len;
+		(void)WRW_Write(req->sp->wrk, st->ptr + off, len);
 	}
-	assert(u == sp->req->obj->len);
+	assert(u == req->obj->len);
 }
 
 /*--------------------------------------------------------------------
@@ -232,14 +227,11 @@ res_WriteDirObj(const struct sess *sp, ssize_t low, ssize_t high)
  */
 
 void
-RES_WriteObj(struct sess *sp)
+RES_WriteObj(struct req *req)
 {
 	char *r;
 	ssize_t low, high;
-	struct req *req;
 
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	req = sp->req;
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
 	/*
@@ -254,44 +246,44 @@ RES_WriteObj(struct sess *sp)
 	    cache_param->http_range_support &&
 	    req->obj->response == 200 &&
 	    http_GetHdr(req->http, H_Range, &r))
-		res_dorange(sp, r, &low, &high);
+		res_dorange(req, r, &low, &high);
 
-	WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp);
+	WRW_Reserve(req->sp->wrk, &req->sp->fd, req->vsl, req->t_resp);
 
 	/*
 	 * Send HTTP protocol header, unless interior ESI object
 	 */
 	if (!(req->res_mode & RES_ESI_CHILD))
-		sp->wrk->acct_tmp.hdrbytes +=
-		    http_Write(sp->wrk, req->resp, 1);
+		req->sp->wrk->acct_tmp.hdrbytes +=
+		    http_Write(req->sp->wrk, req->resp, 1);
 
 	if (!req->wantbody)
 		req->res_mode &= ~RES_CHUNKED;
 
 	if (req->res_mode & RES_CHUNKED)
-		WRW_Chunked(sp->wrk);
+		WRW_Chunked(req->sp->wrk);
 
 	if (!req->wantbody) {
 		/* This was a HEAD or conditional request */
 	} else if (req->obj->len == 0) {
 		/* Nothing to do here */
 	} else if (req->res_mode & RES_ESI) {
-		ESI_Deliver(sp);
+		ESI_Deliver(req);
 	} else if (req->res_mode & RES_ESI_CHILD && req->gzip_resp) {
-		ESI_DeliverChild(sp);
+		ESI_DeliverChild(req->sp);
 	} else if (req->res_mode & RES_ESI_CHILD &&
 	    !req->gzip_resp && req->obj->gziped) {
-		res_WriteGunzipObj(sp);
+		res_WriteGunzipObj(req->sp);
 	} else if (req->res_mode & RES_GUNZIP) {
-		res_WriteGunzipObj(sp);
+		res_WriteGunzipObj(req->sp);
 	} else {
-		res_WriteDirObj(sp, low, high);
+		res_WriteDirObj(req, low, high);
 	}
 
 	if (req->res_mode & RES_CHUNKED &&
 	    !(req->res_mode & RES_ESI_CHILD))
-		WRW_EndChunk(sp->wrk);
+		WRW_EndChunk(req->sp->wrk);
 
-	if (WRW_FlushRelease(sp->wrk) && sp->fd >= 0)
-		SES_Close(sp, "remote closed");
+	if (WRW_FlushRelease(req->sp->wrk) && req->sp->fd >= 0)
+		SES_Close(req->sp, "remote closed");
 }
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 36ff4c6..aedbc98 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -556,6 +556,6 @@ VRT_r_req_backend_healthy(const struct req *req)
 {
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(req->director, DIRECTOR_MAGIC);
-	return (VDI_Healthy(req->director, req->sp));
+	return (VDI_Healthy(req->director, req));
 }
 



More information about the varnish-commit mailing list