[master] f4e21600d slightly polish the previous two commits

Nils Goroll nils.goroll at uplex.de
Mon Jan 11 14:26:03 UTC 2021


commit f4e21600dfff2d5566a57c784449431df4c36248
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Nov 27 17:28:45 2020 +0100

    slightly polish the previous two commits
    
    instead of overriding ctx.ws spefically, just let the Req2Ctx settings
    win
    
    This also moves pipe logging to the client side where it belongs.

diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c
index 50e487f63..595265f55 100644
--- a/bin/varnishd/cache/cache_director.c
+++ b/bin/varnishd/cache/cache_director.c
@@ -206,9 +206,8 @@ VDI_Http1Pipe(struct req *req, struct busyobj *bo)
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	INIT_OBJ(ctx, VRT_CTX_MAGIC);
-	VCL_Req2Ctx(ctx, req);
 	VCL_Bo2Ctx(ctx, bo);
-	ctx->ws = req->ws;
+	VCL_Req2Ctx(ctx, req);
 
 	d = VDI_Resolve(ctx);
 	if (d == NULL || d->vdir->methods->http1pipe == NULL) {
diff --git a/bin/varnishd/cache/cache_vrt_vcl.c b/bin/varnishd/cache/cache_vrt_vcl.c
index 96537a943..04cc68107 100644
--- a/bin/varnishd/cache/cache_vrt_vcl.c
+++ b/bin/varnishd/cache/cache_vrt_vcl.c
@@ -451,22 +451,20 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	INIT_OBJ(&ctx, VRT_CTX_MAGIC);
+	if (bo != NULL) {
+		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+		CHECK_OBJ_NOTNULL(bo->vcl, VCL_MAGIC);
+		VCL_Bo2Ctx(&ctx, bo);
+	}
 	if (req != NULL) {
+		if (bo != NULL)
+			assert(method == VCL_MET_PIPE);
 		CHECK_OBJ(req, REQ_MAGIC);
 		CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC);
 		CHECK_OBJ_NOTNULL(req->vcl, VCL_MAGIC);
 		CHECK_OBJ_NOTNULL(req->top, REQTOP_MAGIC);
 		VCL_Req2Ctx(&ctx, req);
 	}
-	if (bo != NULL) {
-		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-		CHECK_OBJ_NOTNULL(bo->vcl, VCL_MAGIC);
-		VCL_Bo2Ctx(&ctx, bo);
-		if (req) {
-			assert(method == VCL_MET_PIPE);
-			ctx.ws = req->ws;
-		}
-	}
 	assert(ctx.now != 0);
 	ctx.specific = specific;
 	ctx.method = method;
diff --git a/bin/varnishtest/tests/v00051.vtc b/bin/varnishtest/tests/v00051.vtc
index 42c12ed3e..8948d76d5 100644
--- a/bin/varnishtest/tests/v00051.vtc
+++ b/bin/varnishtest/tests/v00051.vtc
@@ -158,9 +158,6 @@ logexpect l2 -v v1 -g vxid -q "vxid == 1012" {
 	expect 0 =	BereqHeader	{^X-Forwarded-For: }
 	expect 0 =	BereqHeader	{^X-Varnish: 1011}
 	expect 0 =	BereqHeader	{^Connection: close}
-	expect 0 =	VCL_call	{^PIPE}
-	expect 0 =	VCL_Error	{^Forced failure}
-	expect 0 =	VCL_return	{^fail}
 	expect 0 =	BereqAcct	{^0 0 0 0 0 0}
 	expect 0 =	End
 } -start
@@ -182,6 +179,9 @@ logexpect l3 -v v1 -g vxid -q "vxid == 1011" {
 	expect 0 =	VCL_call        {^HASH}
 	expect 0 =	VCL_return      {^lookup}
 	expect 0 =	Link            {^bereq 1012 pipe}
+	expect 0 =	VCL_call	{^PIPE}
+	expect 0 =	VCL_Error	{^Forced failure}
+	expect 0 =	VCL_return	{^fail}
 	expect 0 =	RespProtocol    {^HTTP/1.1}
 	expect 0 =	RespStatus      {^503}
 	expect 0 =	RespReason      {^VCL failed}


More information about the varnish-commit mailing list