From 11756556e996944363f888fe38d6c139b4ef6bf2 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 7 Aug 2007 07:23:10 +0000 Subject: [PATCH] Implement "error" action in vcl_fetch() and vcl_deliver() git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1808 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_center.c | 31 +++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index e7cc5341..6d1f4e9e 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -149,8 +149,17 @@ cnt_deliver(struct sess *sp) sp->t_resp = TIM_real(); RES_BuildHttp(sp); VCL_deliver_method(sp); - if (sp->handling != VCL_RET_DELIVER) + switch (sp->handling) { + case VCL_RET_DELIVER: + break; + case VCL_RET_ERROR: + HSH_Deref(sp->obj); + sp->obj = NULL; + sp->step = STP_ERROR; + return (0); + default: INCOMPL(); + } RES_WriteObj(sp); HSH_Deref(sp->obj); @@ -323,11 +332,23 @@ cnt_fetch(struct sess *sp) VCL_fetch_method(sp); - if (sp->handling == VCL_RET_ERROR) - INCOMPL(); - - if (sp->handling == VCL_RET_PASS) + switch (sp->handling) { + case VCL_RET_ERROR: + sp->obj->ttl = 0; + sp->obj->cacheable = 0; + HSH_Unbusy(sp->obj); + HSH_Deref(sp->obj); + sp->obj = NULL; + sp->step = STP_ERROR; + return (0); + case VCL_RET_PASS: sp->obj->pass = 1; + break; + case VCL_RET_INSERT: + break; + default: + INCOMPL(); + } } sp->obj->cacheable = 1; -- 2.39.5