[master] a34ea21b5 vmod_debug: Test all VCL types as optional arguments

Nils Goroll nils.goroll at uplex.de
Tue Apr 22 07:38:08 UTC 2025


commit a34ea21b5e8e9dbac4e04f333404d3c791932e49
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Apr 17 19:13:56 2025 +0200

    vmod_debug: Test all VCL types as optional arguments

diff --git a/bin/varnishtest/tests/m00019.vtc b/bin/varnishtest/tests/m00019.vtc
index 8d480854a..54562521f 100644
--- a/bin/varnishtest/tests/m00019.vtc
+++ b/bin/varnishtest/tests/m00019.vtc
@@ -28,7 +28,7 @@ varnish v1 -vcl+backend {
 		set resp.http.foo4 = debug.argtest("1", 2.4, three="3d", four=-1);
 		set resp.http.foo5 = debug.argtest("1", 2.5);
 		set resp.http.foo6 = debug.argtest("1", four=6);
-		set resp.http.foo7 = debug.argtest("1", opt="7");
+		set resp.http.foo7 = debug.argtest("1", string="7");
 
 		set resp.http.obj0 = obj0.string() + ", " + obj0.number();
 		set resp.http.obj1 = obj1.string() + ", " + obj1.number();
diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index 73155871a..ecdd41155 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -223,7 +223,7 @@ xyzzy_argtest(VRT_CTX, struct VARGS(argtest) *arg)
 	AN(arg);
 	bprintf(buf, "%s %g %s %s %jd %d %s",
 	    arg->one, arg->two, arg->three, arg->comma, (intmax_t)arg->four,
-	    arg->valid_opt, arg->valid_opt ? arg->opt : "<undef>");
+	    arg->valid_string, arg->valid_string ? arg->string : "<undef>");
 	return (WS_Copy(ctx->ws, buf, -1));
 }
 
diff --git a/vmod/vmod_debug.vcc b/vmod/vmod_debug.vcc
index fcf7cca27..bf69c6e34 100644
--- a/vmod/vmod_debug.vcc
+++ b/vmod/vmod_debug.vcc
@@ -138,7 +138,26 @@ Encrypt the HTTP header with quad-ROT13 encryption,
 $Function STRING argtest(
 	  STRING one, REAL two =2, STRING three= "3",
 	  STRING comma=",", INT four = 4,
-	  [ STRING opt])
+	  [ ACL acl],
+	  [ BACKEND backend],
+	  [ BLOB blob],
+	  [ BODY body],
+	  [ BOOL bool:boolean],
+	  [ BYTES bytes],
+	  [ DURATION duration],
+	  [ ENUM enum:enumeration],
+	  [ HEADER header],
+	  [ HTTP http],
+	  [ INT int:integer],
+	  [ IP ip],
+	  [ PROBE probe],
+	  [ REAL real],
+	  [ REGEX regex],
+	  [ STEVEDORE stevedore],
+	  [ STRANDS strands],
+	  [ STRING string],
+	  [ SUB sub],
+	  [ TIME time])
 
 $Function INT vre_limit()
 


More information about the varnish-commit mailing list