Commit 11d1aee0 authored by Bill Stoddard's avatar Bill Stoddard
Browse files

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]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89353 13f79535-47bb-0310-9956-ffa450edef68
parent 3c74d954
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
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]
+13 −1
Original line number Diff line number Diff line
@@ -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
+9 −3
Original line number Diff line number Diff line
@@ -75,9 +75,10 @@
 *   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 
@@ -113,6 +114,11 @@
 * 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"