[4.1] edf2a34 Enforce that req.body caching can only be done on the first tour through vcl_recv{}
Lasse Karstensen
lkarsten at varnish-software.com
Thu Feb 11 17:14:33 CET 2016
commit edf2a34932c28da6810659ffd567da3b985e6b41
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Feb 10 11:19:13 2016 +0000
Enforce that req.body caching can only be done on the first
tour through vcl_recv{}
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index f50621e..63f0ba2 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -199,6 +199,14 @@ VRB_Cache(struct req *req, ssize_t maxsize)
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ /*
+ * We only allow caching to happen the first time through vcl_recv{}
+ * where we know we will have no competition or conflicts for the
+ * updates to req.http.* etc.
+ */
+ if (req->restarts > 0 && req->req_body_status != REQ_BODY_CACHED)
+ return (-1);
+
assert (req->req_step == R_STP_RECV);
switch(req->req_body_status) {
case REQ_BODY_CACHED:
More information about the varnish-commit
mailing list