Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-zipflow
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-zipflow
Commits
7d378554
Unverified
Commit
7d378554
authored
Jul 25, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make subreq() work
parent
99a7d77f
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
514 additions
and
55 deletions
+514
-55
configure.ac
configure.ac
+10
-0
Makefile.am
src/Makefile.am
+4
-2
flint.lnt
src/flint.lnt
+4
-1
vmod_zipflow.c
src/vmod_zipflow.c
+367
-46
vmod_zipflow.vcc
src/vmod_zipflow.vcc
+14
-6
sub-coalesce.vtc
src/vtc/sub-coalesce.vtc
+64
-0
sub.vtc
src/vtc/sub.vtc
+51
-0
No files found.
configure.ac
View file @
7d378554
...
...
@@ -25,6 +25,16 @@ AC_ARG_WITH([rst2man],
VARNISH_PREREQ([6.0.0])
VARNISH_VMODS([zipflow])
AC_ARG_VAR([VARNISHSRC], [path to Varnish source])
if test "x$VARNISHSRC" = x; then
AC_MSG_FAILURE([Need VARNISHSRC])
fi
VARNISHSRC_CFLAGS="$VARNISHAPI_CFLAGS \
-I$VARNISHSRC/include \
-I$VARNISHSRC/bin/varnishd \
-I$VARNISHSRC/lib/libvsc"
AC_SUBST([VARNISHSRC_CFLAGS])
AC_CONFIG_FILES([
Makefile
src/Makefile
...
...
src/Makefile.am
View file @
7d378554
AM_CFLAGS
=
$(VARNISH
API
_CFLAGS)
$(ZLIB_CFLAGS)
-I
../foreign/zipflow
AM_CFLAGS
=
$(VARNISH
SRC
_CFLAGS)
$(ZLIB_CFLAGS)
-I
../foreign/zipflow
# Modules
...
...
@@ -29,7 +29,9 @@ AM_VTC_LOG_FLAGS = \
TESTS
=
\
vtc/vmod_zipflow.vtc
\
vtc/empty.vtc
\
vtc/coverage.vtc
vtc/coverage.vtc
\
vtc/sub.vtc
\
vtc/sub-coalesce.vtc
# Documentation
...
...
src/flint.lnt
View file @
7d378554
...
...
@@ -3,6 +3,7 @@
-efile(766, vmod_compat.h)
-e717 // do ... while(0)
-e663 // array to pointer
-ecall(835, dlopen)
-e801 // goto
...
...
@@ -19,4 +20,6 @@
// assert constructors not referenced
-esym(528, assert_*)
-emacro(747, WS_TASK_ALLOC_OBJ)
\ No newline at end of file
-emacro(747, WS_TASK_ALLOC_OBJ)
-emacro(527, WRONG)
-emacro(506, VSTAILQ_FOREACH_SAFE)
\ No newline at end of file
src/vmod_zipflow.c
View file @
7d378554
This diff is collapsed.
Click to expand it.
src/vmod_zipflow.vcc
View file @
7d378554
...
...
@@ -37,17 +37,25 @@ Example
set resp.filters += " zipflow";
}
$Function VOID subreq(STRING url)
$Function VOID subreq(STRING url
, STRING host=0
)
$Restrict client
Issue a sub requets to *
url
* when the VDP runs, similar to ESI
Issue a sub requets to *
host*/*uri
* when the VDP runs, similar to ESI
processing.
This function can be called any number of times. The sub request can
be identified using `zipflow.is_subreq()`_. In the sub request,
`zipflow.set_level()`_ and `zipflow.meta()`_ should be used to control
how zipflow handles the body.
If *host* is omitted (default), it is taken from the parent request.
This function can be called any number of times to add multiple
files, it can eben be called from a sub request, which is to say that
more files can be added while requests for files are processed.
The sub request can be identified using `zipflow.is_subreq()`_. In the
sub request, `zipflow.set_level()`_ and `zipflow.meta()`_ should be
used to control how zipflow handles the body.
Only sub requests with reponse status 200 will be included in the
resulting zip file.
$Function BOOL is_subreq()
...
...
src/vtc/sub-coalesce.vtc
0 → 100644
View file @
7d378554
varnishtest "vmod-zipflow sub request / race & waitinglist"
feature cmd "type curl && type unzip && echo 'foo' grep -P '^foo'"
server s1 {
rxreq
expect req.url == "/file1"
txresp -gziplevel 1 -gziplen 10240
rxreq
expect req.url == "/file2"
txresp -bodylen 20480
} -start
varnish v1 -vcl+backend {
import zipflow;
sub vcl_recv {
zipflow.set_level(0);
if (zipflow.is_subreq()) {
return (hash);
}
return (synth(200));
}
sub vcl_synth {
synthetic("top zip");
zipflow.meta(name="top");
zipflow.subreq("/file1");
zipflow.subreq("/file2");
set resp.filters += " zipflow";
return (deliver);
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.bodylen == 31102
} -start
client c2 {
txreq
rxresp
expect resp.status == 200
expect resp.bodylen == 31102
} -start
client c3 {
txreq
rxresp
expect resp.status == 200
expect resp.bodylen == 31102
} -start
client c4 {
txreq
rxresp
expect resp.status == 200
expect resp.bodylen == 31102
} -start
client c1 -wait
client c2 -wait
client c3 -wait
client c4 -wait
\ No newline at end of file
src/vtc/sub.vtc
0 → 100644
View file @
7d378554
varnishtest "vmod-zipflow sub request"
feature cmd "type curl && type unzip && echo 'foo' grep -P '^foo'"
varnish v1 -vcl {
import zipflow;
import std;
backend proforma none;
sub vcl_recv {
return (synth(200));
}
sub synth_top {
synthetic("top zip");
zipflow.meta(name="top");
zipflow.subreq("/file1");
zipflow.subreq("/file2");
set resp.filters += " zipflow";
}
sub synth_sub {
synthetic("sub " + req.url);
}
sub vcl_synth {
if (zipflow.is_subreq()) {
call synth_sub;
if (req.url == "/file1") {
zipflow.meta(name="file1.changed");
zipflow.subreq("/file3");
} else
if (req.url == "/file3") {
zipflow.subreq("/file4");
}
} else {
call synth_top;
}
return (deliver);
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
} -run
# all default
shell "curl -so t.zip -H 'Host: ${v1_addr}' http://${v1_addr}:${v1_port}/ && unzip -Z t.zip"
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