From 28b870826a4134f61e6764640628d8c27244113f Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 2 Mar 2009 13:39:09 +0000 Subject: [PATCH] Cache the vcl_fetch{} result, in case vcl_discard{} (via LRU) overwrites it during body fetch. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3856 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_center.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 706bab62..37fb8fb9 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -380,6 +380,7 @@ cnt_fetch(struct sess *sp) struct http *hp, *hp2; struct object *o; char *b; + unsigned handling; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC); @@ -442,7 +443,14 @@ cnt_fetch(struct sess *sp) VCL_fetch_method(sp); - o = HSH_NewObject(sp, sp->handling != VCL_RET_DELIVER); + /* + * When we fetch the body, we may hit the LRU cleanup and that + * will overwrite sp->handling, so we have to save our plans + * here. + */ + handling = sp->handling; + + o = HSH_NewObject(sp, handling != VCL_RET_DELIVER); if (sp->objhead != NULL) { CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC); @@ -498,7 +506,7 @@ cnt_fetch(struct sess *sp) VBE_free_bereq(&sp->bereq); - switch (sp->handling) { + switch (handling) { case VCL_RET_RESTART: HSH_Drop(sp); sp->director = NULL; -- 2.39.5