]> granicus.if.org Git - apache/commitdiff
Extend mod_setenvif to support specifying regular expressions
authorBill Stoddard <stoddard@apache.org>
Tue, 12 Jun 2001 17:06:04 +0000 (17:06 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 12 Jun 2001 17:06:04 +0000 (17:06 +0000)
on the SetEnvIf (and SetEnvIfNoCase) directive attribute field.
Example:  SetEnvIf ^TS*  [a-z].* HAVE_TS
will cause HAVE_TS to be set if any of the request headers begins
with "TS" and has a value that begins with any character in the
set [a-z]. [Bill Stoddard]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89353 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_setenvif.html
modules/metadata/mod_setenvif.c

diff --git a/CHANGES b/CHANGES
index d46cea222008a0c932b3ab44adaff6ae34bf070f..8a94136e63812faf8dfdf84ab7bf596e34cbd2ef 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,11 @@
 Changes with Apache 2.0.19-dev
+  *) Extend mod_setenvif to support specifying regular expressions
+     on the SetEnvIf (and SetEnvIfNoCase) directive attribute field.
+     Example:  SetEnvIf ^TS*  [a-z].* HAVE_TS 
+     will cause HAVE_TS to be set if any of the request headers begins 
+     with "TS" and has a value that begins with any character in the
+     set [a-z]. [Bill Stoddard]
+
   *) httpd children now re-bind themselves to a random CPU on
      multiprocessor systems on AIX via bindprocessor() in 2.0.
      [Victor J. Orlikowski]
index 34ee26ce61f06d9cb8adb687aecdb662778abad3..53cca77a57b2e64bce4013a604d84af3d4c6ab06 100644 (file)
@@ -338,6 +338,12 @@ REL="Help"
    scope.</STRONG>
   </BLOCKQUOTE>
   <P>
+  <EM>attribute</EM> may be a regular expression when used to match a request header.
+  If <EM>attribute</EM> is a regular expression and it doesn't match any of the
+  request's header names, then <EM>attribute</EM> is not tested against the request's
+  environment variable list.
+  </P>
+  <P>
   Example:
   </P>
   <PRE>
@@ -348,6 +354,8 @@ REL="Help"
    SetEnvIf Referer www\.mydomain\.com intra_site_referral
         :
    SetEnvIf object_is_image xbm XBIT_PROCESSING=1
+        :
+   SetEnvIf ^TS*  ^[a-z].*  HAVE_TS
   </PRE>
   <P>
   The first three will set the environment variable <SAMP>object_is_image</SAMP> if the
@@ -355,7 +363,11 @@ REL="Help"
   <SAMP>intra_site_referral</SAMP> if the referring page was somewhere
   on the <SAMP>www.mydomain.com</SAMP> Web site.
   </P>
-
+  <P>
+  The last example will set environment variable <SAMP>HAVE_TS</SAMP> if the request
+  contains any headers that begin with "TS" whose values begins with any character
+  in the set [a-z].
+  </P>
   <HR> <!-- the HR is part of the directive description -->
   <H2>
    <A NAME="SetEnvIfNoCase">SetEnvIfNoCase directive
index 05c64262c820cabfd064327319369795d83e09fc..761fcc75ec0adbd2d74cabcb27d2b99e75ca8548 100644 (file)
  *   SetEnvIf name regex var ...
  *
  * where name is either a HTTP request header name, or one of the
- * special values (see below). The 'value' of the header (or the
- * value of the special value from below) are compared against the
- * regex argument. If this is a simple string, a simple sub-string
+ * special values (see below). 'name' may be a regex when it is used
+ * to specify an HTTP request header name. The 'value' of the header 
+ & (or the value of the special value from below) are compared against
+ * the regex argument. If this is a simple string, a simple sub-string
  * match is performed. Otherwise, a request expression match is
  * done. If the value matches the string or regular expression, the
  * environment variables listed as var ... are set. Each var can 
  * This could be written as:
  *
  *    SetEnvIf remote_addr (127.0.0.1|192.168.10.) LOCAL
+ *
+ * To set HAVE_TS if the client request contains any header beginning
+ * with "TS" with a value beginning with a lower case alphabet:
+ *
+ *    SetEnvIf ^TS* ^[a-z].* HAVE_TS
  */
 
 #include "apr.h"