[master] c082835 Drop the body of hit-for-pass objects once we have delivered them to the original requester.

Poul-Henning Kamp phk at varnish-cache.org
Mon Feb 27 09:32:39 CET 2012


commit c082835a88462548bddf78fa7c88fb948fc1f1d2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 27 08:31:41 2012 +0000

    Drop the body of hit-for-pass objects once we have delivered them to
    the original requester.
    
    Submitted by:	DocWilco

diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index b6ee5a5..6e6d54f 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -327,6 +327,7 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
 
 	AZ(req->busyobj);
 	req->director = NULL;
@@ -334,6 +335,13 @@ cnt_deliver(struct sess *sp, struct worker *wrk, struct req *req)
 
 	RES_WriteObj(sp);
 
+	/* No point in saving the body if it is hit-for-pass */
+	if (req->obj->objcore != NULL) {
+		CHECK_OBJ_NOTNULL(req->obj->objcore, OBJCORE_MAGIC);
+		if (req->obj->objcore->flags & OC_F_PASS)
+			STV_Freestore(req->obj);
+	}
+
 	assert(WRW_IsReleased(wrk));
 	(void)HSH_Deref(&wrk->stats, NULL, &req->obj);
 	http_Teardown(req->resp);



More information about the varnish-commit mailing list