[4.0] 41ee65f Fail the fetch processing if the vep callback failed.
Lasse Karstensen
lkarsten at varnish-software.com
Wed Feb 11 14:01:28 CET 2015
commit 41ee65f07722e397133bb14944163d0ae2d900c9
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Fri Feb 6 11:39:40 2015 +0100
Fail the fetch processing if the vep callback failed.
Fixes: #1637
diff --git a/bin/varnishd/cache/cache_esi_fetch.c b/bin/varnishd/cache/cache_esi_fetch.c
index 41bea3b..cc93194 100644
--- a/bin/varnishd/cache/cache_esi_fetch.c
+++ b/bin/varnishd/cache/cache_esi_fetch.c
@@ -137,6 +137,8 @@ vfp_esi_end(struct busyobj *bo, struct vef_priv *vef, enum vfp_status retval)
}
if (vef->ibuf != NULL)
free(vef->ibuf);
+ if (vef->error)
+ retval = VFP_ERROR;
FREE_OBJ(vef);
return (retval);
}
@@ -160,7 +162,10 @@ vfp_esi_gzip_pull(struct busyobj *bo, void *p, ssize_t *lp, intptr_t *priv)
vef->ibuf_i = vef->ibuf;
vef->ibuf_o = vef->ibuf;
*priv = (uintptr_t)vef;
- return (VFP_OK);
+ if (vef->error)
+ return (VFP_ERROR);
+ else
+ return (VFP_OK);
}
if (p == vfp_fini) {
if (*priv)
diff --git a/bin/varnishtest/tests/r01637.vtc b/bin/varnishtest/tests/r01637.vtc
new file mode 100644
index 0000000..9ffdcee
--- /dev/null
+++ b/bin/varnishtest/tests/r01637.vtc
@@ -0,0 +1,32 @@
+varnishtest "do_esi + do_gzip + out of storage: #1637"
+
+server s1 {
+ # First consume (almost) all of the storage
+ rxreq
+ expect req.url == /url1
+ txresp -bodylen 1040000
+
+ rxreq
+ expect req.url == /url2
+ txresp -bodylen 1040000
+} -start
+
+varnish v1 -arg "-smalloc,1M" -arg "-p nuke_limit=0" -vcl+backend {
+ sub vcl_backend_response {
+ if (bereq.url == "/url2") {
+ set beresp.do_esi = true;
+ set beresp.do_gzip = true;
+ }
+ }
+} -start
+
+
+client c1 {
+ txreq -url /url1
+ rxresp
+ expect resp.status == 200
+
+ txreq -url /url2
+ rxresp
+ expect resp.status == 503
+} -run
More information about the varnish-commit
mailing list