[master] 628fdea Tag struct http with which vsl buffer to use.

Poul-Henning Kamp phk at varnish-cache.org
Tue Feb 14 10:35:22 CET 2012


commit 628fdeacf3efc8450d8722a6205339d8acd9aa8c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 14 09:35:10 2012 +0000

    Tag struct http with which vsl buffer to use.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 94c0284..98771a3 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -167,6 +167,7 @@ struct http {
 #define HTTP_MAGIC		0x6428b5c9
 
 	enum httpwhence		logtag;
+	struct vsl_log		*vsl;
 
 	struct ws		*ws;
 	txt			*hd;
@@ -817,7 +818,7 @@ void http_SetHeader(struct worker *w, unsigned vsl_id, struct http *to,
     const char *hdr);
 void http_SetH(const struct http *to, unsigned n, const char *fm);
 void http_ForceGet(const struct http *to);
-void http_Setup(struct http *ht, struct ws *ws);
+void http_Setup(struct http *ht, struct ws *ws, struct vsl_log *);
 void http_Teardown(struct http *ht);
 int http_GetHdr(const struct http *hp, const char *hdr, char **ptr);
 int http_GetHdrData(const struct http *hp, const char *hdr,
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 5e85542..f7cbc38 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -274,7 +274,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
 			req->obj->last_lru = req->t_resp;
 		req->obj->last_use = req->t_resp;	/* XXX: locking ? */
 	}
-	http_Setup(req->resp, req->ws);
+	http_Setup(req->resp, req->ws, req->vsl);
 	RES_BuildHttp(sp);
 	VCL_deliver_method(sp);
 	switch (req->handling) {
@@ -569,7 +569,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
 	AZ(wrk->busyobj->should_close);
 	AZ(req->storage_hint);
 
-	http_Setup(wrk->busyobj->beresp, wrk->busyobj->ws);
+	http_Setup(wrk->busyobj->beresp, wrk->busyobj->ws, wrk->busyobj->vsl);
 
 	need_host_hdr = !http_GetHdr(wrk->busyobj->bereq, H_Host, NULL);
 
@@ -1223,7 +1223,7 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
 	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
 	AZ(req->obj);
 
-	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
+	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws, wrk->busyobj->vsl);
 	http_FilterReq(sp, HTTPH_R_FETCH);
 	http_ForceGet(wrk->busyobj->bereq);
 	if (cache_param->http_gzip_support) {
@@ -1298,7 +1298,7 @@ cnt_pass(struct sess *sp, struct worker *wrk, const struct req *req)
 
 	wrk->busyobj = VBO_GetBusyObj(wrk);
 	wrk->busyobj->vsl->wid = sp->vsl_id;
-	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
+	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws, wrk->busyobj->vsl);
 	http_FilterReq(sp, HTTPH_R_PASS);
 
 	VCL_pass_method(sp);
@@ -1353,7 +1353,7 @@ cnt_pipe(struct sess *sp, struct worker *wrk, const struct req *req)
 	wrk->acct_tmp.pipe++;
 	wrk->busyobj = VBO_GetBusyObj(wrk);
 	wrk->busyobj->vsl->wid = sp->vsl_id;
-	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
+	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws, wrk->busyobj->vsl);
 	http_FilterReq(sp, 0);
 
 	VCL_pipe_method(sp);
@@ -1529,7 +1529,7 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req)
 
 	EXP_Clr(&req->exp);
 
-	http_Setup(req->http, req->ws);
+	http_Setup(req->http, req->ws, req->vsl);
 	req->err_code = http_DissectRequest(sp);
 
 	/* If we could not even parse the request, just close */
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index d947de1..c8db4c7 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -130,10 +130,11 @@ HTTP_create(void *p, uint16_t nhttp)
 /*--------------------------------------------------------------------*/
 
 void
-http_Setup(struct http *hp, struct ws *ws)
+http_Setup(struct http *hp, struct ws *ws, struct vsl_log *vsl)
 {
 	http_Teardown(hp);
 	hp->ws = ws;
+	hp->vsl = vsl;
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 22971a3..5c44c98 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -250,7 +250,7 @@ STV_MkObject(struct worker *wrk, void *ptr, unsigned ltot,
 	WS_Assert(o->ws_o);
 	assert(o->ws_o->e <= (char*)ptr + ltot);
 
-	http_Setup(o->http, o->ws_o);
+	http_Setup(o->http, o->ws_o, wrk->busyobj->vsl);
 	o->http->magic = HTTP_MAGIC;
 	o->exp = wrk->busyobj->exp;
 	VTAILQ_INIT(&o->store);



More information about the varnish-commit mailing list