r3263 - in trunk/varnish-cache/bin: varnishd varnishtest/tests

tfheen at projects.linpro.no tfheen at projects.linpro.no
Tue Oct 7 13:00:38 CEST 2008


Author: tfheen
Date: 2008-10-07 13:00:38 +0200 (Tue, 07 Oct 2008)
New Revision: 3263

Added:
   trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Make sure error works in vcl_fetch

error was unimplemented in vcl_fetch.  Implement it and add a test
case.


Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2008-10-07 10:57:35 UTC (rev 3262)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2008-10-07 11:00:38 UTC (rev 3263)
@@ -426,6 +426,14 @@
 		break;
 	case VCL_RET_DELIVER:
 		break;
+	case VCL_RET_ERROR:
+		sp->step = STP_ERROR;
+		sp->obj->ttl = 0;
+		sp->obj->cacheable = 0;
+		HSH_Unbusy(sp);
+		HSH_Deref(sp->obj);
+		sp->obj = NULL;
+		return (0);
 	default:
 		WRONG("Illegal action in vcl_fetch{}");
 	}

Added: trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc	2008-10-07 11:00:38 UTC (rev 3263)
@@ -0,0 +1,21 @@
+# $Id$
+
+test "Check that error in vcl_fetch works"
+
+server s1 {
+	rxreq 
+	txresp -body "012345\n"
+} -start
+
+varnish v1 -vcl+backend { 
+	sub vcl_fetch {
+	    set obj.http.Foo = "bar";
+	    error 523 "not ok";
+	}
+} -start
+
+client c1 {
+	txreq -url "/"
+	rxresp
+	expect resp.status == 523
+} -run




More information about the varnish-commit mailing list