]> err.no Git - varnish/commitdiff
Updated the default.vcl and man page with the latest config from mgt_vcc.c.
authorpetter <petter@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Jul 2008 09:07:24 +0000 (09:07 +0000)
committerpetter <petter@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Jul 2008 09:07:24 +0000 (09:07 +0000)
The following perl one-liner is useful:
perl -ne 'if( $print == 1 ) { exit if( /^$/ ); eval "print " . $_; } $print = 1 if /default_vcl/;' mgt_vcc.c
Fixes #135 (for now)

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2994 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/etc/default.vcl
varnish-cache/man/vcl.7

index 3b28bd65c30ae7d6b0521e376e6918ac06247cee..71987d64730a2f9a912928280034465596bb82cc 100644 (file)
@@ -20,16 +20,25 @@ backend default {
 ## Called when a client request is received
 #
 #sub vcl_recv {
-#      if (req.request != "GET" && req.request != "HEAD") {
-#              pipe;
-#      }
-#      if (req.http.Expect) {
-#              pipe;
-#      }
-#      if (req.http.Authenticate || req.http.Cookie) {
-#              pass;
-#      }
-#      lookup;
+#    if (req.request != "GET" &&
+#      req.request != "HEAD" &&
+#      req.request != "PUT" &&
+#      req.request != "POST" &&
+#      req.request != "TRACE" &&
+#      req.request != "OPTIONS" &&
+#      req.request != "DELETE") {
+#        pipe;
+#    }
+#    if (req.http.Expect) {
+#        pipe;
+#    }
+#    if (req.request != "GET" && req.request != "HEAD") {
+#        pass;
+#    }
+#    if (req.http.Authorization || req.http.Cookie) {
+#        pass;
+#    }
+#    lookup;
 #}
 #
 ## Called when entering pipe mode
@@ -47,9 +56,13 @@ backend default {
 ## Called when entering an object into the cache
 #
 #sub vcl_hash {
-#      set req.hash += req.url;
-#      set req.hash += req.http.host;
-#      hash;
+#    set req.hash += req.url;
+#    if (req.http.host) {
+#        set req.hash += req.http.host;
+#    } else {
+#        set req.hash += server.ip;
+#    }
+#    hash;
 #}
 #
 ## Called when the requested object was found in the cache
@@ -71,19 +84,18 @@ backend default {
 ## backend, or the request to the backend has failed
 #
 #sub vcl_fetch {
-#      if (!obj.valid) {
-#              error;
-#      }
-#      if (!obj.cacheable) {
-#              pass;
-#      }
-#      if (obj.http.Set-Cookie) {
-#              pass;
-#      }
-#      insert;
+#    if (!obj.valid) {
+#        error obj.status;
+#    }
+#    if (!obj.cacheable) {
+#        pass;
+#    }
+#    if (obj.http.Set-Cookie) {
+#        pass;
+#    }
+#       set obj.prefetch =  -30s;    insert;
 #}
 #
-#
 ## Called before a cached object is delivered to the client
 #
 #sub vcl_deliver {
@@ -96,7 +108,7 @@ backend default {
 #      discard;
 #}
 #
-## Called when an object is about to be discarded
+# Called when an object is about to be discarded
 #
 #sub vcl_discard {
 #    discard;
index 6d1e0bdc2d866cff59d4cf4cd0567583a087d8ca..c9c1ef8d350a1abb86de18661db3ff71d6b47376 100644 (file)
@@ -507,13 +507,22 @@ backend default {
 }
 
 sub vcl_recv {
-    if (req.request != "GET" && req.request != "HEAD") {
+    if (req.request != "GET" &&
+      req.request != "HEAD" &&
+      req.request != "PUT" &&
+      req.request != "POST" &&
+      req.request != "TRACE" &&
+      req.request != "OPTIONS" &&
+      req.request != "DELETE") {
         pipe;
     }
     if (req.http.Expect) {
         pipe;
     }
-    if (req.http.Authenticate || req.http.Cookie) {
+    if (req.request != "GET" && req.request != "HEAD") {
+        pass;
+    }
+    if (req.http.Authorization || req.http.Cookie) {
         pass;
     }
     lookup;
@@ -529,7 +538,11 @@ sub vcl_pass {
 
 sub vcl_hash {
     set req.hash += req.url;
-    set req.hash += req.http.host;
+    if (req.http.host) {
+        set req.hash += req.http.host;
+    } else {
+        set req.hash += server.ip;
+    }
     hash;
 }
 
@@ -546,7 +559,7 @@ sub vcl_miss {
 
 sub vcl_fetch {
     if (!obj.valid) {
-        error;
+        error obj.status;
     }
     if (!obj.cacheable) {
         pass;
@@ -554,18 +567,18 @@ sub vcl_fetch {
     if (obj.http.Set-Cookie) {
         pass;
     }
-    insert;
+        set obj.prefetch =  -30s;    insert;
 }
 
 sub vcl_deliver {
     deliver;
 }
 
-sub vcl_timeout {
+sub vcl_discard {
     discard;
 }
 
-sub vcl_discard {
+sub vcl_timeout {
     discard;
 }
 .Ed