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
811c0c54
Commit
811c0c54
authored
Sep 12, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for support of PRIV_TASK in CLI induced VCL events.
Part of #2061
parent
4cd32f56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
v00041.vtc
bin/varnishtest/tests/v00041.vtc
+30
-4
vmod.vcc
lib/libvmod_debug/vmod.vcc
+1
-1
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+11
-1
No files found.
bin/varnishtest/tests/v00041.vtc
View file @
811c0c54
...
...
@@ -11,13 +11,21 @@ varnish v1 -vcl+backend {
import debug;
import std;
sub vcl_init {
debug.test_priv_task("something");
debug.test_priv_task("to remember");
std.log(debug.test_priv_task());
}
sub vcl_recv {
set req.http.x0 = debug.test_priv_task(req.url);
debug.test_priv_task(req.url);
set req.http.x0 = debug.test_priv_task();
debug.test_priv_task("bazz");
}
sub vcl_deliver {
set resp.http.x0 = req.http.x0;
set resp.http.x1 = debug.test_priv_task(
""
);
set resp.http.x1 = debug.test_priv_task();
}
sub vcl_backend_fetch {
...
...
@@ -32,19 +40,37 @@ varnish v1 -vcl+backend {
}
} -start
logexpect l1 -v v1 -g raw -d 1 {
expect 0 0 CLI {^Rd vcl.load}
expect 0 = VCL_Log {^something to remember}
expect * 1002 Begin fetch$
expect * = VCL_call ^BACKEND_FETCH
expect 0 = VCL_Log ^foo
expect 0 = BereqHeader {^bx0: /foobar}
expect 0 = VCL_Log ^bar
expect * 1004 Begin fetch$
expect * = VCL_call ^BACKEND_FETCH
expect 0 = VCL_Log ^foo
expect 0 = BereqHeader {^bx0: /snafu}
expect 0 = VCL_Log ^bar
} -start
client c1 {
txreq -url /foobar
rxresp
expect resp.http.x0 == /foobar
expect resp.http.x1 ==
/foobar
expect resp.http.x1 ==
"/foobar bazz"
expect resp.http.bx0 == /foobar
expect resp.http.bx1 == /foobar
txreq -url /snafu
rxresp
expect resp.http.x0 == /snafu
expect resp.http.x1 ==
/snafu
expect resp.http.x1 ==
"/snafu bazz"
expect resp.http.bx0 == /snafu
expect resp.http.bx1 == /snafu
} -run
logexpect l1 -wait
lib/libvmod_debug/vmod.vcc
View file @
811c0c54
...
...
@@ -51,7 +51,7 @@ $Function VOID test_priv_vcl(PRIV_VCL)
Test function for VCL private pointers
$Function STRING test_priv_task(PRIV_TASK, STRING)
$Function STRING test_priv_task(PRIV_TASK, STRING
s=""
)
Test function for TASK private pointers
...
...
lib/libvmod_debug/vmod_debug.c
View file @
811c0c54
...
...
@@ -101,9 +101,19 @@ vmod_test_priv_task(VRT_CTX, struct vmod_priv *priv, VCL_STRING s)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
(
priv
->
priv
==
NULL
)
{
if
(
s
==
NULL
||
*
s
==
'\0'
)
{
return
priv
->
priv
;
}
else
if
(
priv
->
priv
==
NULL
)
{
priv
->
priv
=
strdup
(
s
);
priv
->
free
=
free
;
}
else
{
char
*
n
=
realloc
(
priv
->
priv
,
strlen
(
priv
->
priv
)
+
strlen
(
s
)
+
2
);
if
(
n
==
NULL
)
return
NULL
;
strcat
(
n
,
" "
);
strcat
(
n
,
s
);
priv
->
priv
=
n
;
}
return
(
priv
->
priv
);
}
...
...
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