[master] 71f8160 Use the busyobj workspace for random VCL work in vcl_backend_*{}

Poul-Henning Kamp phk at varnish-cache.org
Mon Apr 22 11:26:10 CEST 2013


commit 71f81608d04d276f0162b737592f4fdaeb948ba9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 22 09:25:45 2013 +0000

    Use the busyobj workspace for random VCL work in vcl_backend_*{}
    
    Minor polish

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 3b06a8d..17222a0 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -417,7 +417,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
 		AZ(bo->do_pass);
 
 		VCL_backend_response_method(req->vcl, wrk, req, NULL,
-		    req->http->ws);
+		    bo->beresp->ws);
 
 		if (bo->do_pass)
 			req->objcore->flags |= OC_F_PASS;
@@ -924,7 +924,7 @@ cnt_miss(struct worker *wrk, struct req *req)
 		http_SetHeader(bo->bereq, "Accept-Encoding: gzip");
 	}
 
-	VCL_backend_fetch_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_backend_fetch_method(req->vcl, wrk, req, NULL, bo->bereq->ws);
 	VCL_miss_method(req->vcl, wrk, req, NULL, req->http->ws);
 
 	if (wrk->handling == VCL_RET_FETCH) {
@@ -989,7 +989,7 @@ cnt_pass(struct worker *wrk, struct req *req)
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
 	http_FilterReq(req, HTTPH_R_PASS);
 
-	VCL_backend_fetch_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_backend_fetch_method(req->vcl, wrk, req, NULL, bo->bereq->ws);
 	VCL_pass_method(req->vcl, wrk, req, NULL, req->http->ws);
 
 	if (wrk->handling == VCL_RET_ERROR) {
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 7c70c11..de40572 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -355,7 +355,12 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv)
 		VBE_UseHealth(vcl->conf->director[i]);
 }
 
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * Method functions to call into VCL programs.
+ *
+ * Either the request or busyobject must be specified, but not both.
+ * The workspace argument is where random VCL stuff gets space from.
+ */
 
 static void
 vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
@@ -391,6 +396,7 @@ VCL_##func##_method(struct VCL_conf *vcl, struct worker *wrk,		\
      struct req *req, struct busyobj *bo, struct ws *ws)		\
 {									\
 									\
+	CHECK_OBJ_NOTNULL(vcl, VCL_CONF_MAGIC);				\
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);				\
 	vcl_call_method(wrk, req, bo, ws, VCL_MET_ ## upper,		\
 	    vcl->func##_func);						\



More information about the varnish-commit mailing list