[master] 603e1cb Add a currently unused vcl_backend_error{} method

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 18 09:36:45 CET 2014


commit 603e1cbd752961c3cdd6fd5fc4f2e279f676ddec
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 18 08:36:26 2014 +0000

    Add a currently unused vcl_backend_error{} method

diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl
index 00f5f6c..09c08cc 100644
--- a/bin/varnishd/builtin.vcl
+++ b/bin/varnishd/builtin.vcl
@@ -41,6 +41,9 @@
 
 vcl 4.0;
 
+#######################################################################
+# Client side
+
 sub vcl_recv {
     if (req.restarts == 0) {
 	if (req.http.x-forwarded-for) {
@@ -117,27 +120,6 @@ sub vcl_miss {
     return (fetch);
 }
 
-
-sub vcl_backend_fetch {
-    return (fetch);
-}
-
-sub vcl_backend_response {
-    if (beresp.ttl <= 0s ||
-        beresp.http.Set-Cookie ||
-        beresp.http.Surrogate-control ~ "no-store" ||
-        (!beresp.http.Surrogate-Control &&
-          beresp.http.Cache-Control ~ "no-cache|no-store|private") ||
-        beresp.http.Vary == "*") {
-		/*
-		 * Mark as "Hit-For-Pass" for the next 2 minutes
-		 */
-		set beresp.ttl = 120s;
-		set beresp.uncacheable = true;
-    }
-    return (deliver);
-}
-
 sub vcl_deliver {
     /*
      * These two write to the stored object causing extra page faults
@@ -176,6 +158,36 @@ sub vcl_error {
     return (deliver);
 }
 
+#######################################################################
+# Backend Fetch
+
+sub vcl_backend_fetch {
+    return (fetch);
+}
+
+sub vcl_backend_response {
+    if (beresp.ttl <= 0s ||
+        beresp.http.Set-Cookie ||
+        beresp.http.Surrogate-control ~ "no-store" ||
+        (!beresp.http.Surrogate-Control &&
+          beresp.http.Cache-Control ~ "no-cache|no-store|private") ||
+        beresp.http.Vary == "*") {
+		/*
+		 * Mark as "Hit-For-Pass" for the next 2 minutes
+		 */
+		set beresp.ttl = 120s;
+		set beresp.uncacheable = true;
+    }
+    return (deliver);
+}
+
+sub vcl_backend_error {
+	return (deliver);
+}
+
+#######################################################################
+# Housekeeping
+
 sub vcl_init {
     return (ok);
 }
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 466bf6b..0702465 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -78,6 +78,10 @@ tokens = {
 # Our methods and actions
 
 returns =(
+
+	###############################################################
+	# Client side
+
 	('recv',
 		"C",
 		('error', 'pass', 'pipe', 'hash', 'purge',)
@@ -106,6 +110,18 @@ returns =(
 		"C",
 		('error', 'restart', 'pass', 'fetch', 'deliver',)
 	),
+	('deliver',
+		"C",
+		('restart', 'deliver',)
+	),
+	('error',
+		"C",
+		('restart', 'deliver',)
+	),
+
+	###############################################################
+	# Backend-fetch 
+
 	('backend_fetch',
 		"B",
 		('fetch', 'abandon')
@@ -114,14 +130,14 @@ returns =(
 		"B",
 		('deliver', 'retry', 'abandon')
 	),
-	('deliver',
-		"C",
-		('restart', 'deliver',)
-	),
-	('error',
-		"C",
-		('restart', 'deliver',)
+	('backend_error',
+		"B",
+		('deliver', 'retry')
 	),
+
+	###############################################################
+	# Housekeeping
+
 	('init',
 		"",
 		('ok',)



More information about the varnish-commit mailing list