[master] 7c64816 Enforce that req.body caching can only be done on the first tour through vcl_recv{}
Poul-Henning Kamp
phk at FreeBSD.org
Wed Feb 10 12:19:41 CET 2016
commit 7c648165657258ba667d59e16fff2ac711ee0bab
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 06a43fa..51492d3 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -190,6 +190,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