Fail if there is no body

parent 4b730f74
......@@ -41,6 +41,7 @@ AM_VTC_LOG_FLAGS = \
TESTS = \
zfr_iter_test \
vtc/vmod_zipflow.vtc \
vtc/zero.vtc \
vtc/empty.vtc \
vtc/coverage.vtc \
vtc/sub.vtc \
......
......@@ -616,6 +616,11 @@ vdp_zipflow_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
return (1);
}
if (vdc->req->resp_len == 0) {
VSLb(vdc->vsl, SLT_Error, "zipflow: need body bytes");
return (-1);
}
if (zft->body_resp) {
zfr->bundle = 0;
WS_TOP_ALLOC_OBJ(ctx, zft->zis, ZFR_ITER_MAGIC);
......
......@@ -112,6 +112,11 @@ Example: Read URLs to bundle into the ZIP from the request body
VCL INTERFACE REFERENCE
=======================
**NOTE** Varnish-Cache does not support content generated by Varnish
Delivery Processors if there is not response body to be sent. This
means that, on the top level, a response body must always be present,
as illustrated by ``set resp.body = " ";`` in the examples above.
$Function VOID subreq(STRING url, STRING host=0)
$Restrict client
......
varnishtest "test vmod-zipflow: zero response cant work"
varnish v1 -vcl {
import zipflow;
backend proforma none;
sub vcl_recv {
return (synth(200));
}
sub vcl_synth {
if (zipflow.is_subreq()) {
synthetic("file content");
} else {
set resp.filters += " zipflow";
zipflow.subreq("/file");
synthetic("");
}
return (deliver);
}
} -start
client c1 {
txreq
expect_close
} -run
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