[master] 8410629 Have calls to VCL methods provide bo, rather than derive it magically from req.

Poul-Henning Kamp phk at varnish-cache.org
Fri May 3 09:36:07 CEST 2013


commit 8410629be00ab5024926a441b6c843038a90ecc7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 3 07:35:40 2013 +0000

    Have calls to VCL methods provide bo, rather than derive it magically
    from req.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 097f259..9eef389 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -416,7 +416,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
 		AZ(bo->do_esi);
 		AZ(bo->do_pass);
 
-		VCL_backend_response_method(req->vcl, wrk, req, NULL,
+		VCL_backend_response_method(bo->vcl, wrk, req, bo,
 		    bo->beresp->ws);
 
 		if (bo->do_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, bo->bereq->ws);
+	VCL_backend_fetch_method(bo->vcl, wrk, req, bo, bo->bereq->ws);
 	VCL_miss_method(req->vcl, wrk, req, NULL, req->http->ws);
 
 	if (wrk->handling == VCL_RET_FETCH) {
@@ -989,8 +989,8 @@ 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, bo->bereq->ws);
-	VCL_pass_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_backend_fetch_method(bo->vcl, wrk, req, bo, bo->bereq->ws);
+	VCL_pass_method(bo->vcl, wrk, req, bo, bo->bereq->ws);
 
 	if (wrk->handling == VCL_RET_ERROR) {
 		http_Teardown(bo->bereq);
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index c7f7002..96288b6 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -391,7 +391,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 	memset(&ctx, 0, sizeof ctx);
 	ctx.magic = VRT_CTX_MAGIC;
 	if (req != NULL) {
-		AZ(bo);
+		// AZ(bo);
 		CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 		CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC);
 		vsl = req->vsl;
@@ -403,16 +403,6 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 		if (req->obj)
 			ctx.http_obj = req->obj->http;
 	}
-	if (method == VCL_MET_BACKEND_FETCH ||
-	    method == VCL_MET_PASS ||
-	    method == VCL_MET_MISS ||
-	    method == VCL_MET_PIPE ||
-	    method == VCL_MET_BACKEND_RESPONSE) {
-		/* XXX: temporary workaround */
-		AN(req);
-		bo = req->busyobj;
-		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	}
 	if (bo != NULL) {
 		// AZ(req);
 		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);



More information about the varnish-commit mailing list