r3876 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Mar 4 12:37:39 CET 2009


Author: phk
Date: 2009-03-04 12:37:39 +0100 (Wed, 04 Mar 2009)
New Revision: 3876

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/bin/varnishd/rfc2616.c
Log:
Move beresp from bereq to worker



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2009-03-04 11:28:07 UTC (rev 3875)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2009-03-04 11:37:39 UTC (rev 3876)
@@ -248,7 +248,6 @@
 #define BEREQ_MAGIC		0x3b6d250c
 	VTAILQ_ENTRY(bereq)	list;
 	struct ws		ws[1];
-	struct http		beresp[2];
 	struct http_conn	htc[1];
 	unsigned		cacheable;
 	double			age;

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2009-03-04 11:28:07 UTC (rev 3875)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2009-03-04 11:37:39 UTC (rev 3876)
@@ -163,7 +163,6 @@
 		WS_Init(bereq->ws, "bereq", bereq + 1, len);
 		sp->wrk->stats->n_bereq++;
 	}
-	http_Setup(bereq->beresp, bereq->ws);
 	return (bereq);
 }
 

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2009-03-04 11:28:07 UTC (rev 3875)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2009-03-04 11:37:39 UTC (rev 3876)
@@ -390,13 +390,16 @@
 	AN(sp->director);
 	AZ(sp->vbe);
 
+	sp->wrk->beresp = &sp->wrk->http[1];
+	sp->wrk->beresp1 = &sp->wrk->http[2];
+
 	i = FetchHdr(sp);
 
 	/*
 	 * Save a copy before it might get mangled in VCL.  When it comes to
 	 * dealing with the body, we want to see the unadultered headers.
 	 */
-	sp->bereq->beresp[1] = sp->bereq->beresp[0];
+	*sp->wrk->beresp1 = *sp->wrk->beresp;
 
 	if (i) {
 		sp->err_code = 503;
@@ -411,7 +414,7 @@
 		return (0);
 	}
 
-	sp->err_code = http_GetStatus(sp->bereq->beresp);
+	sp->err_code = http_GetStatus(sp->wrk->beresp);
 
 	/*
 	 * Initial cacheability determination per [RFC2616, 13.4]
@@ -477,7 +480,7 @@
 	WS_Assert(sp->obj->ws_o);
 
 	/* Filter into object */
-	hp = sp->bereq->beresp;
+	hp = sp->wrk->beresp;
 	hp2 = sp->obj->http;
 
 	hp2->logtag = HTTP_Obj;

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-03-04 11:28:07 UTC (rev 3875)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2009-03-04 11:37:39 UTC (rev 3876)
@@ -384,7 +384,7 @@
 		return (__LINE__);
 	}
 
-	hp = bereq->beresp;
+	hp = sp->wrk->beresp;
 
 	if (http_DissectResponse(sp->wrk, bereq->htc, hp)) {
 		VBE_ClosedFd(sp);
@@ -413,7 +413,7 @@
 	CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
 
 	/* We use the unmodified headers */
-	hp = &sp->bereq->beresp[1];
+	hp = sp->wrk->beresp1;
 	AN(sp->director);
 	if (sp->obj->objcore != NULL)		/* pass has no objcore */
 		AN(ObjIsBusy(sp->obj));

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2009-03-04 11:28:07 UTC (rev 3875)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2009-03-04 11:37:39 UTC (rev 3876)
@@ -104,7 +104,7 @@
 		hp = sp->wrk->bereq;
 		break;
 	case HDR_BERESP:
-		hp = sp->bereq->beresp;
+		hp = sp->wrk->beresp;
 		break;
 	case HDR_RESP:
 		hp = sp->http;
@@ -251,8 +251,8 @@
 VRT_DO_HDR(obj,   response,	sp->obj->http,		HTTP_HDR_RESPONSE)
 VRT_DO_HDR(resp,  proto,	sp->http,		HTTP_HDR_PROTO)
 VRT_DO_HDR(resp,  response,	sp->http,		HTTP_HDR_RESPONSE)
-VRT_DO_HDR(beresp,  proto,	sp->bereq->beresp,	HTTP_HDR_PROTO)
-VRT_DO_HDR(beresp,  response,	sp->bereq->beresp,	HTTP_HDR_RESPONSE)
+VRT_DO_HDR(beresp,  proto,	sp->wrk->beresp,	HTTP_HDR_PROTO)
+VRT_DO_HDR(beresp,  response,	sp->wrk->beresp,	HTTP_HDR_RESPONSE)
 
 /*--------------------------------------------------------------------*/
 
@@ -372,12 +372,12 @@
 	char *p;
 
 	assert(num >= 100 && num <= 999);
-	p = WS_Alloc(sp->bereq->beresp->ws, 4);
+	p = WS_Alloc(sp->wrk->beresp->ws, 4);
 	if (p == NULL)
 		WSP(sp, SLT_LostHeader, "%s", "obj.status");
 	else
 		sprintf(p, "%d", num);
-	http_SetH(sp->bereq->beresp, HTTP_HDR_STATUS, p);
+	http_SetH(sp->wrk->beresp, HTTP_HDR_STATUS, p);
 }
 
 int
@@ -386,10 +386,10 @@
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
 	/* XXX: use http_GetStatus() */
-	if (sp->bereq->beresp->status)
-		return (sp->bereq->beresp->status);
-	AN(sp->bereq->beresp->hd[HTTP_HDR_STATUS].b);
-	return (atoi(sp->bereq->beresp->hd[HTTP_HDR_STATUS].b));
+	if (sp->wrk->beresp->status)
+		return (sp->wrk->beresp->status);
+	AN(sp->wrk->beresp->hd[HTTP_HDR_STATUS].b);
+	return (atoi(sp->wrk->beresp->hd[HTTP_HDR_STATUS].b));
 }
 
 

Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/rfc2616.c	2009-03-04 11:28:07 UTC (rev 3875)
+++ trunk/varnish-cache/bin/varnishd/rfc2616.c	2009-03-04 11:37:39 UTC (rev 3876)
@@ -78,7 +78,7 @@
 	const struct http *hp;
 
 	CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
-	hp = sp->bereq->beresp;
+	hp = sp->wrk->beresp;
 
 	assert(sp->bereq->entered != 0.0 && !isnan(sp->bereq->entered));
 	/* If all else fails, cache using default ttl */



More information about the varnish-commit mailing list