[master] 9269215fc Polish: Make v1l check consistent in V1D_Deliver()

Nils Goroll nils.goroll at uplex.de
Sat Apr 8 05:13:05 UTC 2023


commit 9269215fc0060c5d0b9bc0e1fad3e7a9553eedc7
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Apr 8 07:03:15 2023 +0200

    Polish: Make v1l check consistent in V1D_Deliver()
    
    When we fail a HTTP1 connection via v1d_error(), we write directly to
    the file descriptor and thus should assert that there is no V1L (line
    handler) open.
    
    We had this check only for two out of the four early returns from
    V1D_Deliver().

diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 46c663eb7..9d424b4d0 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -72,6 +72,8 @@ v1d_error(struct req *req, const char *msg)
 	    "Server: Varnish\r\n"
 	    "Connection: close\r\n\r\n";
 
+	AZ(req->wrk->v1l);
+
 	VSLbs(req->vsl, SLT_Error, TOSTRAND(msg));
 	VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1");
 	VSLb(req->vsl, SLT_RespStatus, "500");
@@ -122,7 +124,6 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 		VCL_Req2Ctx(ctx, req);
 		if (VDP_Push(ctx, req->vdc, req->ws, &v1d_vdp, NULL)) {
 			v1d_error(req, "workspace_thread overflow");
-			AZ(req->wrk->v1l);
 			return;
 		}
 	}
@@ -144,7 +145,6 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 
 	if (WS_Overflowed(req->wrk->aws)) {
 		v1d_error(req, "workspace_thread overflow");
-		AZ(req->wrk->v1l);
 		return;
 	}
 


More information about the varnish-commit mailing list