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
bc13d834
Commit
bc13d834
authored
Jun 09, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmodtool.py: support default value also for the last argument
closes #1976
parent
dbfb06d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
12 deletions
+17
-12
m00019.vtc
bin/varnishtest/tests/m00019.vtc
+8
-8
vmodtool.py
lib/libvcc/vmodtool.py
+6
-1
vmod.vcc
lib/libvmod_debug/vmod.vcc
+1
-1
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+2
-2
No files found.
bin/varnishtest/tests/m00019.vtc
View file @
bc13d834
...
@@ -22,12 +22,12 @@ client c1 {
...
@@ -22,12 +22,12 @@ client c1 {
txreq
txreq
rxresp
rxresp
expect resp.bodylen == "6"
expect resp.bodylen == "6"
expect resp.http.foo1 == "1 2 3 ,"
expect resp.http.foo1 == "1 2 3 ,
4
"
expect resp.http.foo2 == "1 2 3 ,"
expect resp.http.foo2 == "1 2 3 ,
4
"
expect resp.http.foo3 == "1 2 3 ,"
expect resp.http.foo3 == "1 2 3 ,
4
"
expect resp.http.foo4 == "1 2 3 ,"
expect resp.http.foo4 == "1 2 3 ,
4
"
expect resp.http.foo5 == "1 2 3 ,"
expect resp.http.foo5 == "1 2 3 ,
4
"
expect resp.http.foo6 == "1 2 3 ,"
expect resp.http.foo6 == "1 2 3 ,
4
"
} -run
} -run
delay .1
delay .1
...
@@ -48,10 +48,10 @@ varnish v1 -errvcl {Argument 'one' missing} {
...
@@ -48,10 +48,10 @@ varnish v1 -errvcl {Argument 'one' missing} {
}
}
}
}
varnish v1 -errvcl {Unknown argument 'f
our
'} {
varnish v1 -errvcl {Unknown argument 'f
ive
'} {
import debug;
import debug;
backend b1 {.host = "127.0.0.1";}
backend b1 {.host = "127.0.0.1";}
sub vcl_deliver {
sub vcl_deliver {
set resp.http.foo5 = debug.argtest("1", two=2.0, f
our
="3");
set resp.http.foo5 = debug.argtest("1", two=2.0, f
ive
="3");
}
}
}
}
lib/libvcc/vmodtool.py
View file @
bc13d834
...
@@ -235,7 +235,9 @@ def arg(txt):
...
@@ -235,7 +235,9 @@ def arg(txt):
i
=
s
.
find
(
'='
)
i
=
s
.
find
(
'='
)
j
=
s
.
find
(
','
)
j
=
s
.
find
(
','
)
if
j
>=
0
and
j
<
i
:
if
j
<
0
:
j
=
len
(
s
)
if
j
<
i
:
i
=
-
1
i
=
-
1
if
i
<
0
:
if
i
<
0
:
i
=
s
.
find
(
','
)
i
=
s
.
find
(
','
)
...
@@ -255,11 +257,14 @@ def arg(txt):
...
@@ -255,11 +257,14 @@ def arg(txt):
s
=
s
[
m
.
end
():]
s
=
s
[
m
.
end
():]
else
:
else
:
i
=
s
.
find
(
','
)
i
=
s
.
find
(
','
)
if
i
<
0
:
i
=
len
(
s
)
a
.
defval
=
s
[:
i
]
a
.
defval
=
s
[:
i
]
s
=
s
[
i
:]
s
=
s
[
i
:]
return
a
,
s
return
a
,
s
# XXX cant have ( or ) in an argument default value
class
prototype
(
object
):
class
prototype
(
object
):
def
__init__
(
self
,
st
,
retval
=
True
,
prefix
=
""
):
def
__init__
(
self
,
st
,
retval
=
True
,
prefix
=
""
):
l
=
st
.
line
[
1
]
l
=
st
.
line
[
1
]
...
...
lib/libvmod_debug/vmod.vcc
View file @
bc13d834
...
@@ -95,7 +95,7 @@ Encrypt the HTTP header with quad-ROT13 encryption,
...
@@ -95,7 +95,7 @@ Encrypt the HTTP header with quad-ROT13 encryption,
(this is approx 33% better than triple-DES).
(this is approx 33% better than triple-DES).
$Function STRING argtest(STRING one, REAL two=2, STRING three="3",
$Function STRING argtest(STRING one, REAL two=2, STRING three="3",
STRING comma=",")
STRING comma=","
, INT four=4
)
$Function INT vre_limit()
$Function INT vre_limit()
...
...
lib/libvmod_debug/vmod_debug.c
View file @
bc13d834
...
@@ -186,11 +186,11 @@ vmod_rot52(VRT_CTX, VCL_HTTP hp)
...
@@ -186,11 +186,11 @@ vmod_rot52(VRT_CTX, VCL_HTTP hp)
VCL_STRING
VCL_STRING
vmod_argtest
(
VRT_CTX
,
VCL_STRING
one
,
VCL_REAL
two
,
VCL_STRING
three
,
vmod_argtest
(
VRT_CTX
,
VCL_STRING
one
,
VCL_REAL
two
,
VCL_STRING
three
,
VCL_STRING
comma
)
VCL_STRING
comma
,
VCL_INT
four
)
{
{
char
buf
[
100
];
char
buf
[
100
];
bprintf
(
buf
,
"%s %g %s %s
"
,
one
,
two
,
three
,
comma
);
bprintf
(
buf
,
"%s %g %s %s
%ld"
,
one
,
two
,
three
,
comma
,
four
);
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