[master] 836d855 Remove references to vcl_error.

Per Buer perbu at varnish-software.com
Thu Mar 20 12:26:09 CET 2014


commit 836d85599d38836df5d74c8245c240e4ad362e84
Author: Per Buer <perbu at varnish-software.com>
Date:   Thu Mar 20 12:25:55 2014 +0100

    Remove references to vcl_error.

diff --git a/doc/sphinx/users-guide/devicedetection.rst b/doc/sphinx/users-guide/devicedetection.rst
index e60b438..5750918 100644
--- a/doc/sphinx/users-guide/devicedetection.rst
+++ b/doc/sphinx/users-guide/devicedetection.rst
@@ -251,11 +251,11 @@ VCL::
         # call some detection engine
 
         if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") {
-            error 750 "Moved Temporarily";
+            return(synth(750, "Moved Temporarily"));
         }
     }
      
-    sub vcl_error {
+    sub vcl_synth {
         if (obj.status == 750) {
             set obj.http.Location = "http://m.example.com" + req.url;
             set obj.status = 302;
diff --git a/doc/sphinx/users-guide/purging.rst b/doc/sphinx/users-guide/purging.rst
index 4aad344..058bd7d 100644
--- a/doc/sphinx/users-guide/purging.rst
+++ b/doc/sphinx/users-guide/purging.rst
@@ -99,14 +99,14 @@ You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL::
 	  if (req.method == "BAN") {
                   # Same ACL check as above:
 		  if (!client.ip ~ purge) {
-			  error 405 "Not allowed.";
+			  return(synth(403, "Not allowed."));
 		  }
 		  ban("req.http.host == " + req.http.host +
 		        "&& req.url == " + req.url);
 
 		  # Throw a synthetic page so the
                   # request won't go to the backend.
-		  return(synth(200m"Ban added"));
+		  return(synth(200, "Ban added"));
 	  }
   }
 
@@ -130,7 +130,7 @@ You can use the following template to write ban lurker friendly bans::
   sub vcl_recv {
     if (req.method == "PURGE") {
       if (client.ip !~ purge) {
-        error 401 "Not allowed";
+        return(synth(403, "Not allowed"));
       }
       ban("obj.http.x-url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple
     }
diff --git a/doc/sphinx/users-guide/vcl-built-in-subs.rst b/doc/sphinx/users-guide/vcl-built-in-subs.rst
index 73934c7..b30985c 100644
--- a/doc/sphinx/users-guide/vcl-built-in-subs.rst
+++ b/doc/sphinx/users-guide/vcl-built-in-subs.rst
@@ -22,8 +22,9 @@ yourself doing frequently.
 The vcl_recv subroutine may terminate with calling ``return()`` on one
 of the following keywords:
 
-  error 
-    Return the specified error code to the client and abandon the request.
+  synth 
+    Return a synthetic object with the specified error code to the
+    client and abandon the request.
 
   pass
     Switch to pass mode.  Control will eventually pass to vcl_pass.
@@ -51,7 +52,7 @@ shuffling bytes back and forth.
 The vcl_pipe subroutine may terminate with calling return() with one
 of the following keywords:
 
-  error code [reason]
+  synth(error code, reason)
     Return the specified error code to the client and abandon the request.
 
   pipe
@@ -68,7 +69,7 @@ submitted over the same client connection are handled normally.
 The vcl_pass subroutine may terminate with calling return() with one
 of the following keywords:
 
-  error [reason]
+  synth(error code, reason)
     Return the specified error code to the client and abandon the request.
 
   pass
@@ -157,13 +158,6 @@ keywords:
     error.
 
 
-.. XXX
-.. vcl_error
-.. ~~~~~~~~~
-
-.. Not sure if we're going to keep this around.
-
-
 vcl_backend_fetch
 ~~~~~~~~~~~~~~~~~
 



More information about the varnish-commit mailing list