Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-esicookies
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-esicookies
Commits
9f968efe
Commit
9f968efe
authored
May 03, 2013
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for vcl reloading to ensure the free callback works
parent
454d086b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
0 deletions
+127
-0
vmod_esicookies_reload.vcl
src/tests/vmod_esicookies_reload.vcl
+22
-0
vmod_esicookies_reload.vtc
src/tests/vmod_esicookies_reload.vtc
+105
-0
No files found.
src/tests/vmod_esicookies_reload.vcl
0 → 100644
View file @
9f968efe
## added by vtc script
#
# import esicookies from "${vmod_topbuild}/src/.libs/libvmod_esicookies.so" ;
sub vcl_fetch {
if (req.url == "/body2") {
esicookies.to_http0(beresp.http.Set-Cookie);
} else {
set req.http.X-Err = esicookies.to_http0_e(beresp.http.Set-Cookie);
if (req.http.X-Err != "") {
error 503 "Error in to_http0";
}
unset req.http.X-Err;
}
set beresp.do_esi = true;
}
sub vcl_error {
if (req.http.X-Err) {
set obj.http.X-Err = req.http.X-Err;
}
}
src/tests/vmod_esicookies_reload.vtc
0 → 100644
View file @
9f968efe
varnishtest "test vmod_esicookies reload (mem free)"
server s1 {
rxreq
expect req.http.Cookie == "fromclient=1"
txresp -hdr "Set-Cookie: fromserver1=1" -body {
<html>
Before include
<esi:include
src=
"/body1"
/>
After include 1
}
rxreq
expect req.url == "/body1"
expect req.http.Cookie == "fromclient=1; fromserver1=1"
txresp -hdr "Set-Cookie: frombody1=1; Secure" \
-hdr "Set-Cookie: fromserver1=2; Domain=.foo.com; Path=/; Expires=Wed, 13-Jan-2021 22:23:01 GMT; HttpOnly" \
-hdr "Connection: close" \
-body {
Included file
}
close
accept
rxreq
expect req.http.Cookie == "fromclient=1"
txresp -hdr "Set-Cookie: fromserver1=1" -body {
<html>
Before include
<esi:include
src=
"/body1"
/>
After include 1
}
rxreq
expect req.url == "/body1"
expect req.http.Cookie == "fromclient=1; fromserver1=1"
txresp -hdr "Set-Cookie: frombody1=1; Secure" \
-hdr "Set-Cookie: fromserver1=2; Domain=.foo.com; Path=/; Expires=Wed, 13-Jan-2021 22:23:01 GMT; HttpOnly" \
-hdr "Connection: close" \
-body {
Included file
}
close
accept
rxreq
expect req.http.Cookie == "fromclient=1"
txresp -hdr "Set-Cookie: fromserver1=1" -body {
<html>
Before include
<esi:include
src=
"/body1"
/>
After include 1
}
rxreq
expect req.url == "/body1"
expect req.http.Cookie == "fromclient=1; fromserver1=1"
txresp -hdr "Set-Cookie: frombody1=1; Secure" \
-hdr "Set-Cookie: fromserver1=2; Domain=.foo.com; Path=/; Expires=Wed, 13-Jan-2021 22:23:01 GMT; HttpOnly" \
-hdr "Connection: close" \
-body {
Included file
}
} -start
shell "(echo 'backend foo { .host = \"${s1_addr}\"; .port = \"${s1_port}\"; }'; echo 'import esicookies from \"${vmod_topbuild}/src/.libs/libvmod_esicookies.so\";' ; cat ${vmod_topbuild}/src/tests/vmod_esicookies_reload.vcl ) >${tmpdir}/_esicookies_reload.vcl"
# only one work thread to get rid of the vcls
varnish v1 -arg "-f ${tmpdir}/_esicookies_reload.vcl -p thread_pools=1 -w1,1,300" -start
varnish v1 -cliok "vcl.load foo1 ${tmpdir}/_esicookies_reload.vcl" -cliok "vcl.use foo1"
varnish v1 -expect n_vcl == 2
varnish v1 -expect n_backend == 1
varnish v1 -cliok "vcl.discard boot"
delay 1
varnish v1 -expect n_vcl == 1
varnish v1 -expect n_backend == 1
client c1 {
txreq -url "/" -hdr "Cookie: fromclient=1"
rxresp
} -run
varnish v1 -cliok "vcl.load foo2 ${tmpdir}/_esicookies_reload.vcl" -cliok "vcl.use foo2"
varnish v1 -expect n_vcl == 2
varnish v1 -expect n_backend == 1
varnish v1 -cliok "vcl.discard foo1"
varnish v1 -cli "debug.backend" -cli "vcl.list"
client c1 {
txreq -url "/" -hdr "Cookie: fromclient=1"
rxresp
} -run
delay 3
# worker thread should have let go of the old vcl by now
varnish v1 -cli "debug.backend" -cli "vcl.list"
varnish v1 -expect n_vcl == 1
varnish v1 -expect n_backend == 1
varnish v1 -cliok "vcl.load foo3 ${tmpdir}/_esicookies_reload.vcl" -cliok "vcl.use foo3"
varnish v1 -expect n_vcl == 2
varnish v1 -expect n_backend == 1
varnish v1 -cliok "vcl.discard foo2"
client c1 {
txreq -url "/" -hdr "Cookie: fromclient=1"
rxresp
} -run
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