]> granicus.if.org Git - apache/commitdiff
Add a SERVER_ADDR keyword to match the CGI environment variable,
authorKen Coar <coar@apache.org>
Tue, 12 Nov 2002 18:30:00 +0000 (18:30 +0000)
committerKen Coar <coar@apache.org>
Tue, 12 Nov 2002 18:30:00 +0000 (18:30 +0000)
to allow conditional setting according to the IP address on
which the server received the request.

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

CHANGES
modules/metadata/mod_setenvif.c

diff --git a/CHANGES b/CHANGES
index 36284ddfee0df83686e74cd67534f7e3a22b5484..eadedeba833c938806fea99b49470cc0bbcfc16e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.44
 
+  *) mod_setenvif: Add SERVER_ADDR special keyword to allow
+     envariable setting according to the server IP address
+     which received the request.  [Ken Coar]
+
   *) mod_cgid: Terminate CGI scripts when the client connection 
      drops.  PR 8388  [Jeff Trawick]
 
index ee36cb11e6c7cdf8d167b9320c438eedef2111c0..0ec817153450e16b642c807bef44725269a7e8a1 100644 (file)
@@ -92,6 +92,8 @@
  *
  * Special values for 'name' are:
  *
+ *   server_addr       IP address of interface on which request arrived
+ *                     (analogous to SERVER_ADDR set in ap_add_common_vars())
  *   remote_host        Remote host name (if available)
  *   remote_addr        Remote IP address
  *   remote_user        Remote authenticated user (if any)
@@ -143,7 +145,8 @@ enum special {
     SPECIAL_REMOTE_USER,
     SPECIAL_REQUEST_URI,
     SPECIAL_REQUEST_METHOD,
-    SPECIAL_REQUEST_PROTOCOL
+    SPECIAL_REQUEST_PROTOCOL,
+    SPECIAL_SERVER_ADDR
 };
 typedef struct {
     char *name;                 /* header name */
@@ -376,6 +379,9 @@ static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
         else if (!strcasecmp(fname, "request_protocol")) {
             new->special_type = SPECIAL_REQUEST_PROTOCOL;
         }
+        else if (!strcasecmp(fname, "server_addr")) {
+            new->special_type = SPECIAL_SERVER_ADDR;
+        }
         else {
             new->special_type = SPECIAL_NOT;
             /* Handle fname as a regular expression.
@@ -509,6 +515,9 @@ static int match_headers(request_rec *r)
             case SPECIAL_REMOTE_ADDR:
                 val = r->connection->remote_ip;
                 break;
+            case SPECIAL_SERVER_ADDR:
+                val = r->connection->local_ip;
+                break;
             case SPECIAL_REMOTE_HOST:
                 val =  ap_get_remote_host(r->connection, r->per_dir_config,
                                           REMOTE_NAME, NULL);