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
7920fa70
Unverified
Commit
7920fa70
authored
Sep 10, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does this look better
parent
2e3d1d0d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
86 deletions
+53
-86
README.md
README.md
+6
-11
README.rst
README.rst
+9
-11
vmod_zipflow.man.md
src/vmod_zipflow.man.md
+23
-46
vmod_zipflow.vcc
src/vmod_zipflow.vcc
+15
-18
No files found.
README.md
View file @
7920fa70
...
...
@@ -11,7 +11,7 @@ compress responses into the ZIP format.
# PROJECT RESOURCES
-
The primary repository is at
<https://code.uplex.de/uplex-varnish/
slash
>
<https://code.uplex.de/uplex-varnish/
libvmod-zipflow
>
This server does not accept user registrations, so please \...
...
...
@@ -34,26 +34,21 @@ itself).
## Examples
Example: Send the response body as a zip file containing
\"
filename
\"
: :
Example: Send the response body as a zip file containing
\"
filename
\"
:
import zipflow;
sub vcl_init {
: zipflow.set_level(9);
zipflow.set_level(9);
}
sub vcl_deliver {
: zipflow.meta(\"filename\"); set resp.filters += \" zipflow\";
zipflow.meta("filename");
set resp.filters += " zipflow";
}
Example: Create a two subrequests for other URLs, which are bundled into
the ZIP response
:
the ZIP response:
import zipflow;
...
...
README.rst
View file @
7920fa70
...
...
@@ -43,32 +43,30 @@ itself).
Examples
~~~~~~~~
Example: Send the response body as a zip file containing "filename"
::
Example: Send the response body as a zip file containing "filename"::
import zipflow;
sub vcl_init {
zipflow.set_level(9);
}
sub vcl_deliver {
zipflow.meta("filename");
set resp.filters += " zipflow";
}
Example: Create a two subrequests for other URLs, which are bundled
into the ZIP response
::
into the ZIP response::
import zipflow;
sub vcl_recv {
if (req.url == "/zip") {
return (synth(1200));
}
}
sub synth_zipflow {
if (zipflow.is_subreq()) {
return;
...
...
@@ -76,16 +74,16 @@ into the ZIP response
# activate zipflow
set resp.filters = "zipflow";
set resp.body = " "; // REQUIRED!
# do not put this body into the zip
zipflow.bundle(false);
# create two subrequests to put into the zip
zipflow.subreq("/file1");
zipflow.subreq("/file2");
return (deliver);
}
sub vcl_synth {
if (resp.status == 1200) {
call synth_zipflow;
...
...
src/vmod_zipflow.man.md
View file @
7920fa70
...
...
@@ -35,26 +35,21 @@ This module provides a Varnish Delivery Processor (VDP) interface to
Mark Adler
\'
s
[
zipflow
](
https://github.com/madler/zipflow
)
library to
package and compress responses into the ZIP format.
Example: Send the response body as a zip file containing
\"
filename
\"
: :
Example: Send the response body as a zip file containing
\"
filename
\"
:
import zipflow;
sub vcl_init {
: zipflow.set_level(9);
zipflow.set_level(9);
}
sub vcl_deliver {
: zipflow.meta(\"filename\"); set resp.filters += \" zipflow\";
zipflow.meta("filename");
set resp.filters += " zipflow";
}
Example: Create a two subrequests for other URLs, which are bundled into
the ZIP response
:
the ZIP response:
import zipflow;
...
...
@@ -87,58 +82,40 @@ the ZIP response :
}
}
Example: Read URLs to bundle into the ZIP from the request body
Example: Read URLs to bundle into the ZIP from the request body
:
: :
import zipflow; import std;
import zipflow;
import std;
sub vcl_recv {
:
if (req.url == \"/zip\" && req.method == \"POST\") {
:
if (req.url == "/zip" && req.method == "POST") {
if (! std.cache_req_body(1M)) {
: return (synth(400, \"Need request body\"));
} return (synth(1200));
return (synth(400, "Need request body"));
}
return (synth(1200));
}
}
sub synth_zipflow {
:
if (zipflow.is_subreq()) {
return;
}
# activate zipflow
set resp.filters = "zipflow";
set resp.body = " "; // REQUIRED!
: return;
} \# activate zipflow set resp.filters = \"zipflow\"; set
resp.body = \" \"; // REQUIRED!
\# do not put this body into the zip zipflow.bundle(false);
\# read urls from request body
zipflow.subreqs_from_body(req_body); return (deliver);
# do not put this body into the zip
zipflow.bundle(false);
# read urls from request body
zipflow.subreqs_from_body(req_body);
return (deliver);
}
sub vcl_synth {
:
if (resp.status == 1200) {
: call synth_zipflow;
call synth_zipflow;
}
}
# VCL INTERFACE REFERENCE
...
...
src/vmod_zipflow.vcc
View file @
7920fa70
...
...
@@ -23,32 +23,30 @@ This module provides a Varnish Delivery Processor (VDP) interface to
Mark Adler's `zipflow`_ library to package and compress
responses into the ZIP format.
Example: Send the response body as a zip file containing "filename"
::
Example: Send the response body as a zip file containing "filename"::
import zipflow;
sub vcl_init {
zipflow.set_level(9);
}
sub vcl_deliver {
zipflow.meta("filename");
set resp.filters += " zipflow";
}
Example: Create a two subrequests for other URLs, which are bundled
into the ZIP response
::
into the ZIP response::
import zipflow;
sub vcl_recv {
if (req.url == "/zip") {
return (synth(1200));
}
}
sub synth_zipflow {
if (zipflow.is_subreq()) {
return;
...
...
@@ -56,28 +54,27 @@ into the ZIP response
# activate zipflow
set resp.filters = "zipflow";
set resp.body = " "; // REQUIRED!
# do not put this body into the zip
zipflow.bundle(false);
# create two subrequests to put into the zip
zipflow.subreq("/file1");
zipflow.subreq("/file2");
return (deliver);
}
sub vcl_synth {
if (resp.status == 1200) {
call synth_zipflow;
}
}
Example: Read URLs to bundle into the ZIP from the request body
::
Example: Read URLs to bundle into the ZIP from the request body::
import zipflow;
import std;
sub vcl_recv {
if (req.url == "/zip" && req.method == "POST") {
if (! std.cache_req_body(1M)) {
...
...
@@ -86,7 +83,7 @@ Example: Read URLs to bundle into the ZIP from the request body
return (synth(1200));
}
}
sub synth_zipflow {
if (zipflow.is_subreq()) {
return;
...
...
@@ -94,15 +91,15 @@ Example: Read URLs to bundle into the ZIP from the request body
# activate zipflow
set resp.filters = "zipflow";
set resp.body = " "; // REQUIRED!
# do not put this body into the zip
zipflow.bundle(false);
# read urls from request body
zipflow.subreqs_from_body(req_body);
return (deliver);
}
sub vcl_synth {
if (resp.status == 1200) {
call synth_zipflow;
...
...
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