[7.3] 852eab6fa vmod_h2: VRT_fail if called outside of client context

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Oct 24 15:08:13 UTC 2023


commit 852eab6fa16d2ee90523e49060c842f2e742c98f
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date:   Wed Oct 18 15:32:32 2023 +0200

    vmod_h2: VRT_fail if called outside of client context
    
    Conflicts:
            vmod/vmod_h2.c

diff --git a/vmod/vmod_h2.c b/vmod/vmod_h2.c
index 45642f140..f62105384 100644
--- a/vmod/vmod_h2.c
+++ b/vmod/vmod_h2.c
@@ -43,7 +43,12 @@ h2get(VRT_CTX)
 	uintptr_t *up;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); // $Restrict client
+	if (ctx->req == NULL) {
+		VRT_fail(ctx,
+		    "vmod_h2 can only be called from client-side VCL.");
+		return (NULL);
+	}
+	CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
 	if (ctx->req->transport != &HTTP2_transport)
 		return (NULL);
 	AZ(SES_Get_proto_priv(ctx->req->sp, &up));


More information about the varnish-commit mailing list