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
0ad2601b
Commit
0ad2601b
authored
Mar 17, 2023
by
Walid Boudebouda
Committed by
Nils Goroll
Apr 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmod_debug: use $Restrict where relevant and add tests
parent
33d09811
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
9 deletions
+40
-9
v00043.vtc
bin/varnishtest/tests/v00043.vtc
+1
-9
v00051.vtc
bin/varnishtest/tests/v00051.vtc
+27
-0
vmod_debug.vcc
vmod/vmod_debug.vcc
+12
-0
No files found.
bin/varnishtest/tests/v00043.vtc
View file @
0ad2601b
...
...
@@ -98,10 +98,7 @@ varnish v1 -cliok "param.set debug +syncvsl" -vcl+backend {
}
sub vcl_backend_fetch {
if (bereq.url == "/fail") {
# dynamic priv not checked at compile time
o2.test_priv_top("only works on client side");
}
}
sub vcl_backend_response {
...
...
@@ -126,8 +123,3 @@ client c1 {
varnish v1 -expect client_req == 2
client c2 {
txreq -url /fail
rxresp
expect resp.status == 503
} -run
bin/varnishtest/tests/v00051.vtc
View file @
0ad2601b
...
...
@@ -538,3 +538,30 @@ logexpect l1 -v v1 -g raw {
varnish v1 -cliok "vcl.discard vcl10"
logexpect l1 -wait
#######################################################################
# Fail vcl - debug.client_ip function restricted to client and backend
varnish v1 -errvcl {Not available in subroutine 'vcl_init'} {
import debug;
sub vcl_init {
debug.client_ip();
}
}
#######################################################################
# Fail vcl - obj.test_priv_top method restricted to client
varnish v1 -errvcl {Not available in subroutine 'vcl_backend_response'} {
import debug;
sub vcl_init {
new test_obj = debug.obj("bar");
}
sub vcl_backend_response {
set beresp.http.foo = test_obj.test_priv_top();
}
}
vmod/vmod_debug.vcc
View file @
0ad2601b
...
...
@@ -123,6 +123,8 @@ $Method STRING .test_priv_top(STRING s="")
Test per-object priv_top via VRT_priv_top()
$Restrict client
$Function VOID rot104()
Try to register the rot52 filter again. This should always fail
...
...
@@ -285,6 +287,8 @@ $Function VOID catflap(ENUM {miss, first, last} type)
Test the HSH_Lookup catflap
$Restrict client
$Function BYTES stk()
Return an approximation of the amount of stack used.
...
...
@@ -294,6 +298,8 @@ should now only be used for diagnostic purposes.
0B is returned if no sensible value can be determined.
$Restrict client
$Function VOID vcl_prevent_cold(PRIV_VCL)
Prevent VCL from going cold.
...
...
@@ -316,6 +322,8 @@ Set the client socket' send buffer size to *sndbuf*. The previous, desired
and actual values appear in the logs. Not currently implemented for backend
transactions.
$Restrict client backend
$Function VOID store_ip(IP)
Store an IP address to be later found by ``debug.get_ip()`` in the same
...
...
@@ -336,10 +344,14 @@ $Function STRING client_ip()
Get the stringified client ip from the session attr
$Restrict client backend
$Function STRING client_port()
Get the stringified client port from the session attr
$Restrict client backend
$Function VOID fail_task_fini()
fail any task fini before ok_task_fini() is called
...
...
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