[master] 4600acf Add a bunch of (?i) to get the message that the Host: header is case insensitive

Per Andreas Buer perbu at varnish-cache.org
Thu Feb 17 22:13:01 CET 2011


commit 4600acfb2f2a19adb14d27ad5ca948f2e9ed27fa
Author: Per Buer <perbu at varnish-software.com>
Date:   Thu Feb 17 22:12:51 2011 +0100

    Add a bunch of (?i) to get the message that the Host: header is case insensitive

diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst
index aee66cb..c929baf 100644
--- a/doc/sphinx/reference/varnishd.rst
+++ b/doc/sphinx/reference/varnishd.rst
@@ -839,30 +839,36 @@ waiter
 Purge expressions
 -----------------
 
-A purge expression consists of one or more conditions.  A condition consists of a field, an operator, and an
-argument.  Conditions can be ANDed together with "&&".
+A purge expression consists of one or more conditions.  A condition
+consists of a field, an operator, and an argument.  Conditions can be
+ANDed together with "&&".
 
-A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.set-cookie.
+A field can be any of the variables from VCL, for instance req.url,
+req.http.host or obj.set-cookie.
 
-Operators are "==" for direct comparision, "~" for a regular expression match, and ">" or "<" for size compar‐
-isons.  Prepending an operator with "!" negates the expression.
+Operators are "==" for direct comparision, "~" for a regular
+expression match, and ">" or "<" for size comparisons.  Prepending
+an operator with "!" negates the expression.
 
-The argument could be a quoted string, a regexp, or an integer.  Integers can have "KB", "MB", "GB" or "TB"
-appended for size related fields.
+The argument could be a quoted string, a regexp, or an integer.
+Integers can have "KB", "MB", "GB" or "TB" appended for size related
+fields.
 
-Simple example: All requests where req.url exactly matches the string /news are purged from the cache:::
+Simple example: All requests where req.url exactly matches the string
+/news are purged from the cache:::
 
     req.url == "/news"
 
-Example: Purge all documents where the name does not end with ".ogg", and where the size of the object is greater
-than 10 megabytes:::
+Example: Purge all documents where the name does not end with ".ogg",
+and where the size of the object is greater than 10 megabytes:::
 
     req.url !~ "\.ogg$" && obj.size > 10MB
 
-Example: Purge all documents where the serving host is "example.com" or "www.example.com", and where the Set-
-Cookie header received from the backend contains "USERID=1663":::
+Example: Purge all documents where the serving host is "example.com"
+or "www.example.com", and where the Set- Cookie header received from
+the backend contains "USERID=1663":::
 
-    req.http.host ~ "^(www\.)example.com$" && obj.set-cookie ~ "USERID=1663"
+    req.http.host ~ "^(?i)(www\.)example.com$" && obj.set-cookie ~ "USERID=1663"
 
 SEE ALSO
 ========
diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst
index d986cd5..6355913 100644
--- a/doc/sphinx/reference/vcl.rst
+++ b/doc/sphinx/reference/vcl.rst
@@ -92,7 +92,7 @@ A backend declaration creates and initializes a named backend object:::
 
 The backend object can later be used to select a backend at request time:::
 
-  if (req.http.host ~ "^(www.)?example.com$") {
+  if (req.http.host ~ "(?i)^(www.)?example.com$") {
     set req.backend = www;
   }
 
@@ -528,9 +528,9 @@ Example:::
 
 	# in file "backends.vcl"
 	sub vcl_recv {
-	  if (req.http.host ~ "example.com") {
+	  if (req.http.host ~ "(?i)example.com") {
 	    set req.backend = foo;
-	  } elsif (req.http.host ~ "example.org") {
+	  } elsif (req.http.host ~ "(?i)example.org") {
 	    set req.backend = bar;
 	  }
 	}
@@ -731,7 +731,7 @@ Values may be assigned to variables using the set keyword:::
 
   sub vcl_recv {
     # Normalize the Host: header
-    if (req.http.host ~ "^(www.)?example.com$") {
+    if (req.http.host ~ "(?i)^(www.)?example.com$") {
       set req.http.host = "www.example.com";
     }
   }
@@ -803,10 +803,10 @@ based on the request URL:::
   }
   
   sub vcl_recv {
-    if (req.http.host ~ "^(www.)?example.com$") {
+    if (req.http.host ~ "(?i)^(www.)?example.com$") {
       set req.http.host = "www.example.com";
       set req.backend = www;
-    } elsif (req.http.host ~ "^images.example.com$") {
+    } elsif (req.http.host ~ "(?i)^images.example.com$") {
       set req.backend = images;
     } else {
       error 404 "Unknown virtual host";
diff --git a/doc/sphinx/tutorial/increasing_your_hitrate.rst b/doc/sphinx/tutorial/increasing_your_hitrate.rst
index b8fe6c2..f10358f 100644
--- a/doc/sphinx/tutorial/increasing_your_hitrate.rst
+++ b/doc/sphinx/tutorial/increasing_your_hitrate.rst
@@ -177,7 +177,7 @@ Varnish will cache different versions of every page for every
 hostname. You can mitigate this in your web server configuration by
 setting up redirects or by using the following VCL::
 
-  if (req.http.host ~ "^(www.)?varnish-?software.com") {
+  if (req.http.host ~ "(?i)^(www.)?varnish-?software.com") {
     set req.http.host = "varnish-software.com";
   }
 



More information about the varnish-commit mailing list