Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
6515f17e
Commit
6515f17e
authored
Mar 02, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an optional argument to the debug.argtest function
parent
f279df55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
m00019.vtc
bin/varnishtest/tests/m00019.vtc
+8
-6
vmod.vcc
lib/libvmod_debug/vmod.vcc
+3
-1
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+5
-3
No files found.
bin/varnishtest/tests/m00019.vtc
View file @
6515f17e
...
@@ -24,6 +24,7 @@ varnish v1 -vcl+backend {
...
@@ -24,6 +24,7 @@ varnish v1 -vcl+backend {
set resp.http.foo4 = debug.argtest("1", 2.4, three="3d", four=-1);
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.foo5 = debug.argtest("1", 2.5);
set resp.http.foo6 = debug.argtest("1", four=6);
set resp.http.foo6 = debug.argtest("1", four=6);
set resp.http.foo7 = debug.argtest("1", opt="7");
set resp.http.obj0 = obj0.string() + ", " + obj0.number();
set resp.http.obj0 = obj0.string() + ", " + obj0.number();
set resp.http.obj1 = obj1.string() + ", " + obj1.number();
set resp.http.obj1 = obj1.string() + ", " + obj1.number();
...
@@ -38,12 +39,13 @@ client c1 {
...
@@ -38,12 +39,13 @@ client c1 {
txreq
txreq
rxresp
rxresp
expect resp.bodylen == "6"
expect resp.bodylen == "6"
expect resp.http.foo1 == "1 2.1 3a , 4"
expect resp.http.foo1 == "1 2.1 3a , 4 0 <undef>"
expect resp.http.foo2 == "1 -2.2 3b , 4"
expect resp.http.foo2 == "1 -2.2 3b , 4 0 <undef>"
expect resp.http.foo3 == "1 2.3 3c , 4"
expect resp.http.foo3 == "1 2.3 3c , 4 0 <undef>"
expect resp.http.foo4 == "1 2.4 3d , -1"
expect resp.http.foo4 == "1 2.4 3d , -1 0 <undef>"
expect resp.http.foo5 == "1 2.5 3 , 4"
expect resp.http.foo5 == "1 2.5 3 , 4 0 <undef>"
expect resp.http.foo6 == "1 2 3 , 6"
expect resp.http.foo6 == "1 2 3 , 6 0 <undef>"
expect resp.http.foo7 == "1 2 3 , 4 1 7"
expect resp.http.obj0 == "default, one"
expect resp.http.obj0 == "default, one"
expect resp.http.obj1 == "only_argument, one"
expect resp.http.obj1 == "only_argument, one"
...
...
lib/libvmod_debug/vmod.vcc
View file @
6515f17e
...
@@ -117,7 +117,9 @@ Encrypt the HTTP header with quad-ROT13 encryption,
...
@@ -117,7 +117,9 @@ Encrypt the HTTP header with quad-ROT13 encryption,
$Function STRING argtest(
$Function STRING argtest(
STRING one, REAL two =2, STRING three= "3",
STRING one, REAL two =2, STRING three= "3",
STRING comma="," , INT four = 4 )
STRING comma=",", INT four = 4,
[ STRING opt]
)
$Function INT vre_limit()
$Function INT vre_limit()
...
...
lib/libvmod_debug/vmod_debug.c
View file @
6515f17e
...
@@ -151,12 +151,14 @@ xyzzy_rot52(VRT_CTX, VCL_HTTP hp)
...
@@ -151,12 +151,14 @@ xyzzy_rot52(VRT_CTX, VCL_HTTP hp)
}
}
VCL_STRING
v_matchproto_
(
td_debug_argtest
)
VCL_STRING
v_matchproto_
(
td_debug_argtest
)
xyzzy_argtest
(
VRT_CTX
,
VCL_STRING
one
,
VCL_REAL
two
,
VCL_STRING
three
,
xyzzy_argtest
(
VRT_CTX
,
struct
xyzzy_argtest_arg
*
arg
)
VCL_STRING
comma
,
VCL_INT
four
)
{
{
char
buf
[
100
];
char
buf
[
100
];
bprintf
(
buf
,
"%s %g %s %s %ld"
,
one
,
two
,
three
,
comma
,
four
);
AN
(
arg
);
bprintf
(
buf
,
"%s %g %s %s %ld %d %s"
,
arg
->
one
,
arg
->
two
,
arg
->
three
,
arg
->
comma
,
arg
->
four
,
arg
->
valid_opt
,
arg
->
valid_opt
?
arg
->
opt
:
"<undef>"
);
return
(
WS_Copy
(
ctx
->
ws
,
buf
,
-
1
));
return
(
WS_Copy
(
ctx
->
ws
,
buf
,
-
1
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment