[4.0] 6cb0f12 Update, mostly vcl_fetch -> vcl_backend_response

Federico G. Schwindt fgsch at lodoss.net
Tue Jun 24 11:31:36 CEST 2014


commit 6cb0f12a52c5a12b4b082ce7ea285a0a05199c8e
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Fri Apr 11 19:09:01 2014 +0100

    Update, mostly vcl_fetch -> vcl_backend_response

diff --git a/doc/sphinx/glossary/index.rst b/doc/sphinx/glossary/index.rst
index 574156b..2f9250e 100644
--- a/doc/sphinx/glossary/index.rst
+++ b/doc/sphinx/glossary/index.rst
@@ -78,7 +78,7 @@ Varnish Glossary
    backend response
         The response specifically served from a backend to
         varnishd. The backend response may be manipulated in
-        vcl_fetch.
+        vcl_backend_response.
 
    body
 	The bytes that make up the contents of the object, varnishd
diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst
index bfae5a5..568d4e3 100644
--- a/doc/sphinx/reference/varnishtest.rst
+++ b/doc/sphinx/reference/varnishtest.rst
@@ -82,9 +82,9 @@ An example::
         } -start
 
         varnish v1 -vcl+backend {
-                sub vcl_fetch {
+                sub vcl_backend_response {
                         set beresp.do_esi = true;
-                        if (req.url == "/foo") {
+                        if (bereq.url == "/foo") {
                                 set beresp.ttl = 0s;
                         } else {
                                 set beresp.ttl = 10m;
diff --git a/doc/sphinx/users-guide/compression.rst b/doc/sphinx/users-guide/compression.rst
index fc84f9f..cb95619 100644
--- a/doc/sphinx/users-guide/compression.rst
+++ b/doc/sphinx/users-guide/compression.rst
@@ -29,7 +29,7 @@ content it will be stored in memory in its compressed form. If the
 backend sends content in clear text it will be stored in clear text.
 
 You can make Varnish compress content before storing it in cache in
-`vcl_fetch` by setting 'do_gzip' to true, like this::
+`vcl_backend_response` by setting 'do_gzip' to true, like this::
 
    sub vcl_backend_response {
         if (beresp.http.content-type ~ "text") {
diff --git a/doc/sphinx/users-guide/devicedetection.rst b/doc/sphinx/users-guide/devicedetection.rst
index 5067c4c..2a0cb21 100644
--- a/doc/sphinx/users-guide/devicedetection.rst
+++ b/doc/sphinx/users-guide/devicedetection.rst
@@ -75,8 +75,8 @@ VCL::
     # If the backend does not mention in Vary that it has crafted special
     # content based on the User-Agent (==X-UA-Device), add it. 
     # If your backend does set Vary: User-Agent, you may have to remove that here.
-    sub vcl_fetch {
-        if (req.http.X-UA-Device) {
+    sub vcl_backend_response {
+        if (bereq.http.X-UA-Device) {
             if (!beresp.http.Vary) { # no Vary at all
                 set beresp.http.Vary = "X-UA-Device"; 
             } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
@@ -85,7 +85,7 @@ VCL::
         }
         # comment this out if you don't want the client to know your
         # classification
-        set beresp.http.X-UA-Device = req.http.X-UA-Device;
+        set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
     }
 
     # to keep any caches in the wild from serving wrong content to client #2
@@ -131,15 +131,15 @@ VCL::
     sub vcl_pass { if (req.http.X-UA-Device) { set bereq.http.User-Agent = req.http.X-UA-Device; } }
 
     # standard Vary handling code from previous examples.
-    sub vcl_fetch {
-        if (req.http.X-UA-Device) {
+    sub vcl_backend_response {
+        if (bereq.http.X-UA-Device) {
             if (!beresp.http.Vary) { # no Vary at all
                 set beresp.http.Vary = "X-UA-Device";
             } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
                 set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
             }
         }
-        set beresp.http.X-UA-Device = req.http.X-UA-Device;
+        set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
     }
     sub vcl_deliver {
         if ((req.http.X-UA-Device) && (resp.http.Vary)) {
@@ -186,8 +186,8 @@ VCL::
 
     # Handle redirects, otherwise standard Vary handling code from previous
     # examples.
-    sub vcl_fetch {
-        if (req.http.X-UA-Device) {
+    sub vcl_backend_response {
+        if (bereq.http.X-UA-Device) {
             if (!beresp.http.Vary) { # no Vary at all
                 set beresp.http.Vary = "X-UA-Device";
             } elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
@@ -203,7 +203,7 @@ VCL::
                 set beresp.http.location = regsub(beresp.http.location, "[?&]devicetype=.*$", "");
             }
         }
-        set beresp.http.X-UA-Device = req.http.X-UA-Device;
+        set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
     }
     sub vcl_deliver {
         if ((req.http.X-UA-Device) && (resp.http.Vary)) {
diff --git a/doc/sphinx/users-guide/esi.rst b/doc/sphinx/users-guide/esi.rst
index 5c7ce72..b81d2ea 100644
--- a/doc/sphinx/users-guide/esi.rst
+++ b/doc/sphinx/users-guide/esi.rst
@@ -50,11 +50,11 @@ Now, lets have an HTML file that has an ESI include statement::
 
 For ESI to work you need to activate ESI processing in VCL, like this::
 
-    sub vcl_fetch {
-    	if (req.url == "/test.html") {
+    sub vcl_backend_response {
+    	if (bereq.url == "/test.html") {
            set beresp.do_esi = true; // Do ESI processing
            set beresp.ttl = 24 h;    // Sets the TTL on the HTML above
-    	} elseif (req.url == "/cgi-bin/date.cgi") {
+    	} elseif (bereq.url == "/cgi-bin/date.cgi") {
            set beresp.ttl = 1m;      // Sets a one minute TTL on
 	       	       	 	     // the included object
         }
diff --git a/doc/sphinx/users-guide/vcl-actions.rst b/doc/sphinx/users-guide/vcl-actions.rst
index 0775afe..d4ede58 100644
--- a/doc/sphinx/users-guide/vcl-actions.rst
+++ b/doc/sphinx/users-guide/vcl-actions.rst
@@ -8,12 +8,12 @@ The most common actions to return are these:
 .. XXX:Maybe a bit more explanation here what is an action and how it is returned? benc
 
 *pass*
- When you return pass the request and subsequent response will be passed to
- and from the backend server. It won't be cached. `pass` can be returned from
- `vcl_recv`
+  When you return pass the request and subsequent response will be passed to
+  and from the backend server. It won't be cached. `pass` can be returned from
+  `vcl_recv`.
 
-*lookup*
-  When you return lookup from `vcl_recv` you tell Varnish to deliver content 
+*hash*
+  When you return hash from `vcl_recv` you tell Varnish to deliver content 
   from cache even if the request othervise indicates that the request 
   should be passed. 
 
@@ -24,18 +24,15 @@ The most common actions to return are these:
   client and the backend connections and Varnish will just sit there
   and shuffle bytes back and forth. Varnish will not look at the data being 
   send back and forth - so your logs will be incomplete. 
-  Beware that with HTTP 1.1 a client can send several requests on the same 
-  connection and so you should instruct Varnish to add a "Connection: close"
-  header before actually returning pipe. 
 
 *deliver*
- Deliver the object to the client. Usually returned from `vcl_backend_response`. 
+  Deliver the object to the client. Usually returned from `vcl_backend_response`. 
 
 *restart*
- Restart processing of the request. You can restart the processing of
- the whole transaction. Changes to the `req` object are retained.
+  Restart processing of the request. You can restart the processing of
+  the whole transaction. Changes to the `req` object are retained.
 
 *retry*
- Retry the request against the backend. This can be called from
- `vcl_backend_response` or `vcl_backend_error` if you don't like the response 
- that the backend delivered.
+  Retry the request against the backend. This can be returned from
+  `vcl_backend_response` or `vcl_backend_error` if you don't like the response 
+  that the backend delivered.
diff --git a/doc/sphinx/users-guide/vcl-built-in-subs.rst b/doc/sphinx/users-guide/vcl-built-in-subs.rst
index 708c05e..0a90a34 100644
--- a/doc/sphinx/users-guide/vcl-built-in-subs.rst
+++ b/doc/sphinx/users-guide/vcl-built-in-subs.rst
@@ -119,7 +119,7 @@ of the following keywords:
 
   fetch
     Retrieve the requested object from the backend. Control will
-    eventually pass to `vcl_fetch`.
+    eventually pass to `vcl_backend_fetch`.
 
 vcl_hash
 ~~~~~~~~
diff --git a/doc/sphinx/users-guide/vcl-example-manipulating-responses.rst b/doc/sphinx/users-guide/vcl-example-manipulating-responses.rst
index 6719524..31e10e1 100644
--- a/doc/sphinx/users-guide/vcl-example-manipulating-responses.rst
+++ b/doc/sphinx/users-guide/vcl-example-manipulating-responses.rst
@@ -6,8 +6,8 @@ Altering the backend response
 Here we override the TTL of a object coming from the backend if it
 matches certain criteria::
 
-  sub vcl_fetch {
-     if (req.url ~ "\.(png|gif|jpg)$") {
+  sub vcl_backend_response {
+     if (bereq.url ~ "\.(png|gif|jpg)$") {
        unset beresp.http.set-cookie;
        set beresp.ttl = 1h;
     }
diff --git a/doc/sphinx/users-guide/vcl-grace.rst b/doc/sphinx/users-guide/vcl-grace.rst
index afc92bd..c3a122c 100644
--- a/doc/sphinx/users-guide/vcl-grace.rst
+++ b/doc/sphinx/users-guide/vcl-grace.rst
@@ -27,7 +27,7 @@ So, in order to serve stale content we must first have some content to
 serve. So to make Varnish keep all objects for 30 minutes beyond their
 TTL use the following VCL::
 
-  sub vcl_fetch {
+  sub vcl_backend_response {
     set beresp.grace = 30m;
   }
 
@@ -45,7 +45,7 @@ minutes if we are unable to serve them? Well, if you have enabled
 backend is sick and if it is we can serve the stale content for a bit
 longer.::
 
-   if (! req.backend.healthy) {
+   if (!std.healthy(backend)) {
       set req.grace = 5m;
    } else {
       set req.grace = 15s;



More information about the varnish-commit mailing list