r3880 - in trunk/varnish-cache: bin/varnishd lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Wed Mar 4 14:00:18 CET 2009


Author: phk
Date: 2009-03-04 14:00:18 +0100 (Wed, 04 Mar 2009)
New Revision: 3880

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/cache_response.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
   trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
   trunk/varnish-cache/lib/libvcl/vcc_obj.c
Log:
Untested to any meaningfull extent:  Make req.* available in vcl_deliver{}



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2009-03-04 13:00:18 UTC (rev 3880)
@@ -162,6 +162,8 @@
 			sp->obj->last_lru = sp->t_resp;	/* XXX: locking ? */
 		sp->obj->last_use = sp->t_resp;	/* XXX: locking ? */
 	}
+	sp->wrk->resp = &sp->wrk->http[2];
+	http_Setup(sp->wrk->resp, sp->wrk->ws);
 	RES_BuildHttp(sp);
 	VCL_deliver_method(sp);
 	switch (sp->handling) {
@@ -180,6 +182,7 @@
 	RES_WriteObj(sp);
 	AZ(sp->wrk->wfd);
 	HSH_Deref(sp->wrk, &sp->obj);
+	sp->wrk->resp = NULL;
 	sp->step = STP_DONE;
 	return (0);
 }
@@ -1116,6 +1119,7 @@
 		CHECK_OBJ_ORNULL(sp->obj, OBJECT_MAGIC);
 		CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 		CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
+		WS_Assert(w->ws);
 
 		switch (sp->step) {
 #define STEP(l,u) \
@@ -1129,6 +1133,7 @@
 		default:
 			WRONG("State engine misfire");
 		}
+		WS_Assert(w->ws);
 		CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
 	}
 	WSL_Flush(w, 0);

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2009-03-04 13:00:18 UTC (rev 3880)
@@ -349,6 +349,11 @@
 		w->beresp = NULL;
 		w->resp = NULL;
 		w->wrq->func(w, w->wrq->priv);
+		AZ(w->bereq);
+		AZ(w->beresp1);
+		AZ(w->beresp);
+		AZ(w->resp);
+		WS_Assert(w->ws);
 		AZ(w->wfd);
 		assert(w->wlp == w->wlb);
 		w->wrq = NULL;

Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2009-03-04 13:00:18 UTC (rev 3880)
@@ -49,16 +49,16 @@
 
 	WSP(sp, SLT_Length, "%u", 0);
 
-	http_ClrHeader(sp->http);
-	sp->http->logtag = HTTP_Tx;
-	http_SetResp(sp->http, "HTTP/1.1", "304", "Not Modified");
+	http_ClrHeader(sp->wrk->resp);
+	sp->wrk->resp->logtag = HTTP_Tx;
+	http_SetResp(sp->wrk->resp, "HTTP/1.1", "304", "Not Modified");
 	TIM_format(sp->t_req, lm);
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Date: %s", lm);
-	http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish");
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid);
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", lm);
+	http_SetHeader(sp->wrk, sp->fd, sp->wrk->resp, "Via: 1.1 varnish");
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "X-Varnish: %u", sp->xid);
 	TIM_format(sp->obj->last_modified, lm);
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Last-Modified: %s", lm);
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Connection: %s",
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Last-Modified: %s", lm);
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Connection: %s",
 	    sp->doclose ? "close" : "keep-alive");
 	sp->wantbody = 0;
 }
@@ -99,29 +99,29 @@
 
 	WSP(sp, SLT_Length, "%u", sp->obj->len);
 
-	http_ClrHeader(sp->http);
-	sp->http->logtag = HTTP_Tx;
-	http_CopyResp(sp->http, sp->obj->http);
-	http_FilterFields(sp->wrk, sp->fd, sp->http, sp->obj->http,
+	http_ClrHeader(sp->wrk->resp);
+	sp->wrk->resp->logtag = HTTP_Tx;
+	http_CopyResp(sp->wrk->resp, sp->obj->http);
+	http_FilterFields(sp->wrk, sp->fd, sp->wrk->resp, sp->obj->http,
 	    HTTPH_A_DELIVER);
 
 	/* Only HTTP 1.1 can do Chunked encoding */
 	if (sp->http->protover < 1.1 && !VTAILQ_EMPTY(&sp->obj->esibits))
-		http_Unset(sp->http, H_Transfer_Encoding);
+		http_Unset(sp->wrk->resp, H_Transfer_Encoding);
 
 	TIM_format(TIM_real(), time_str);
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Date: %s", time_str);
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", time_str);
 
 	if (sp->xid != sp->obj->xid)
-		http_PrintfHeader(sp->wrk, sp->fd, sp->http,
+		http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp,
 		    "X-Varnish: %u %u", sp->xid, sp->obj->xid);
 	else
-		http_PrintfHeader(sp->wrk, sp->fd, sp->http,
+		http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp,
 		    "X-Varnish: %u", sp->xid);
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Age: %.0f",
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Age: %.0f",
 	    sp->obj->age + sp->t_resp - sp->obj->entered);
-	http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish");
-	http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Connection: %s",
+	http_SetHeader(sp->wrk, sp->fd, sp->wrk->resp, "Via: 1.1 varnish");
+	http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Connection: %s",
 	    sp->doclose ? "close" : "keep-alive");
 }
 
@@ -140,7 +140,7 @@
 	WRW_Reserve(sp->wrk, &sp->fd);
 
 	if (sp->esis == 0)
-		sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->http, 1);
+		sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1);
 
 	if (sp->wantbody && !VTAILQ_EMPTY(&sp->obj->esibits)) {
 		if (WRW_FlushRelease(sp->wrk)) {

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2009-03-04 13:00:18 UTC (rev 3880)
@@ -107,7 +107,7 @@
 		hp = sp->wrk->beresp;
 		break;
 	case HDR_RESP:
-		hp = sp->http;
+		hp = sp->wrk->resp;
 		break;
 	case HDR_OBJ:
 		hp = sp->obj->http;
@@ -249,8 +249,8 @@
 VRT_DO_HDR(bereq, proto,	sp->wrk->bereq,		HTTP_HDR_PROTO)
 VRT_DO_HDR(obj,   proto,	sp->obj->http,		HTTP_HDR_PROTO)
 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(resp,  proto,	sp->wrk->resp,		HTTP_HDR_PROTO)
+VRT_DO_HDR(resp,  response,	sp->wrk->resp,		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)
 
@@ -290,20 +290,20 @@
 	char *p;
 
 	assert(num >= 100 && num <= 999);
-	p = WS_Alloc(sp->http->ws, 4);
+	p = WS_Alloc(sp->wrk->ws, 4);
 	if (p == NULL)
 		WSP(sp, SLT_LostHeader, "%s", "resp.status");
 	else
 		sprintf(p, "%d", num);
-	http_SetH(sp->http, HTTP_HDR_STATUS, p);
+	http_SetH(sp->wrk->resp, HTTP_HDR_STATUS, p);
 }
 
 int
 VRT_r_resp_status(const struct sess *sp)
 {
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC);
-	return (atoi(sp->http->hd[HTTP_HDR_STATUS].b));
+	CHECK_OBJ_NOTNULL(sp->wrk->resp, HTTP_MAGIC);
+	return (atoi(sp->wrk->resp->hd[HTTP_HDR_STATUS].b));
 }
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2009-03-04 13:00:18 UTC (rev 3880)
@@ -322,7 +322,7 @@
 
 	/* ../../include/vrt_obj.h */
 
-	vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3834 2009-02-27 12:02:50Z ");
+	vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3838 2009-02-27 15:20:57Z ");
 	vsb_cat(sb, "phk $\n *\n * NB:  This file is machine generated, DO ");
 	vsb_cat(sb, "NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n");
 	vsb_cat(sb, " */\n\nstruct sockaddr * VRT_r_client_ip(const struct ");

Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl	2009-03-04 13:00:18 UTC (rev 3880)
@@ -59,22 +59,22 @@
     # Request paramters
     { req.request
 	RW STRING
-	{recv pipe pass hash miss hit fetch                        error }
+	{recv pipe pass hash miss hit fetch deliver                error }
 	"const struct sess *"
     }
     { req.url
 	RW STRING
-	{recv pipe pass hash miss hit fetch                        error }
+	{recv pipe pass hash miss hit fetch deliver                error }
 	"const struct sess *"
     }
     { req.proto
 	RW STRING
-	{recv pipe pass hash miss hit fetch                        error }
+	{recv pipe pass hash miss hit fetch deliver                error }
 	"const struct sess *"
     }
     { req.http.
 	RW HDR_REQ
-	{recv pipe pass hash miss hit fetch                        error }
+	{recv pipe pass hash miss hit fetch deliver                error }
 	"const struct sess *"
     }
 
@@ -86,7 +86,7 @@
     }
     { req.backend
 	RW BACKEND
-	{recv pipe pass hash miss hit fetch                        error }
+	{recv pipe pass hash miss hit fetch deliver                error }
 	"struct sess *"
     }
     { req.restarts

Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_obj.c	2009-03-04 12:28:16 UTC (rev 3879)
+++ trunk/varnish-cache/lib/libvcl/vcc_obj.c	2009-03-04 13:00:18 UTC (rev 3880)
@@ -36,25 +36,29 @@
 	    "VRT_r_req_request(sp)",	    "VRT_l_req_request(sp, ",
 	    V_RW,	    0,
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH
-	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR
+	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+	     | VCL_MET_ERROR
 	},
 	{ "req.url", STRING, 7,
 	    "VRT_r_req_url(sp)",	    "VRT_l_req_url(sp, ",
 	    V_RW,	    0,
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH
-	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR
+	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+	     | VCL_MET_ERROR
 	},
 	{ "req.proto", STRING, 9,
 	    "VRT_r_req_proto(sp)",	    "VRT_l_req_proto(sp, ",
 	    V_RW,	    0,
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH
-	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR
+	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+	     | VCL_MET_ERROR
 	},
 	{ "req.http.", HEADER, 9,
 	    "VRT_r_req_http_(sp)",	    "VRT_l_req_http_(sp, ",
 	    V_RW,	    "HDR_REQ",
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH
-	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR
+	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+	     | VCL_MET_ERROR
 	},
 	{ "req.hash", HASH, 8,
 	    NULL,	    "VRT_l_req_hash(sp, ",
@@ -65,7 +69,8 @@
 	    "VRT_r_req_backend(sp)",	    "VRT_l_req_backend(sp, ",
 	    V_RW,	    0,
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH
-	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR
+	     | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER
+	     | VCL_MET_ERROR
 	},
 	{ "req.restarts", INT, 12,
 	    "VRT_r_req_restarts(sp)",	    NULL,



More information about the varnish-commit mailing list