Does this look better

parent 2e3d1d0d
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment