]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Add a SERVER_ADDR keyword to match the CGI environment variable,
authorKen Coar <coar@apache.org>
Tue, 12 Nov 2002 19:59:16 +0000 (19:59 +0000)
committerKen Coar <coar@apache.org>
Tue, 12 Nov 2002 19:59:16 +0000 (19:59 +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/branches/1.3.x@97496 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/modules/standard/mod_setenvif.c

index 7f034137dc347f16c0249af0ddaa2efbd7ac4be1..6f84f2a0ca5b673766119f0ec00013bc572c50cb 100644 (file)
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.28
 
+  *) mod_setenvif: Add SERVER_ADDR special keyword to allow
+     envariable setting according to the server IP address
+     which received the request.  [Ken Coar]
+
   *) PORT: Enable SINGLE_LISTEN_UNSERIALIZED_ACCEPT for AIX 4.3.2
      and above.  Update AIX configure logic to allow higher AIX 
      release numbers without having to change Apache.
index ac89f3b0af00e99fb43856441e1df8176d84e276..7cfc9283a793475f288847fe31835a3965072cc8 100644 (file)
@@ -91,6 +91,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)
@@ -127,7 +129,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 */
@@ -279,6 +282,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;
        }
@@ -397,6 +403,10 @@ static int match_headers(request_rec *r)
            case SPECIAL_REMOTE_ADDR:
                val = r->connection->remote_ip;
                break;
+                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);