[master] 610d17740 Simplify initialization of the H2 VDP

Nils Goroll nils.goroll at uplex.de
Wed Dec 27 14:07:06 UTC 2023


commit 610d17740861a521fcf86d656bdc35f4199484c0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Dec 27 10:49:01 2023 +0100

    Simplify initialization of the H2 VDP
    
    Initialize the private pointer directly, instead of indirectly via
    the request struct.

diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 267ea91ea..cdd356d7d 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -75,12 +75,14 @@ V2D_Init(void)
 static int v_matchproto_(vdp_init_f)
 h2_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
 {
+	struct h2_req *r2;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
+	AN(priv);
+	CAST_OBJ_NOTNULL(r2, *priv, H2_REQ_MAGIC);
+	(void)r2;
 	(void)oc;
-	CHECK_OBJ_NOTNULL(vdc->req, REQ_MAGIC);
-	*priv = vdc->req->transport_priv;
 	return (0);
 }
 
@@ -346,7 +348,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
 	if (sendbody) {
 		INIT_OBJ(ctx, VRT_CTX_MAGIC);
 		VCL_Req2Ctx(ctx, req);
-		if (!VDP_Push(ctx, req->vdc, req->ws, &h2_vdp, NULL))
+		if (!VDP_Push(ctx, req->vdc, req->ws, &h2_vdp, r2))
 			(void)VDP_DeliverObj(req->vdc, req->objcore);
 	}
 


More information about the varnish-commit mailing list