]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Add %{CONN_REMOTE_ADDR} to mod_rewrite. PR56094
authorEric Covener <covener@apache.org>
Sat, 1 Feb 2014 14:02:29 +0000 (14:02 +0000)
committerEric Covener <covener@apache.org>
Sat, 1 Feb 2014 14:02:29 +0000 (14:02 +0000)
Submitted By: Edward Lu <Chaosed0 gmail com>
Committed By: covener

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

CHANGES
docs/manual/mod/mod_rewrite.xml
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index 8c2c47c0443265f18f245d2b62f4be827cf92311..fb2d96c99d0c4f2e55ee8b9492664864127b5ee9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_rewrite: Add %{CONN_REMOTE_ADDR} as the non-useragent counterpart to
+     %{REMOTE_ADDR}. PR 56094. [Edward Lu <Chaosed0 gmail com>]
+
   *) mod_dir: Default to 2.2-like behavior and skip execution when method is
      neither GET nor POST, such as for DAV requests. PR 54914. [Chris Darroch]
 
index d0aa4a3ca650b7c745d6e39ab5f66146dde81763..cae83da1d84e5bf7fc0b8014ccbc9688c0a1a846 100644 (file)
@@ -443,6 +443,7 @@ Alias /myapp /opt/myapp-1.2.3
 
               <td>
                  REMOTE_ADDR<br />
+                 CONN_REMOTE_ADDR<br />
                  REMOTE_HOST<br />
                  REMOTE_PORT<br />
                  REMOTE_USER<br />
@@ -571,6 +572,14 @@ Alias /myapp /opt/myapp-1.2.3
                   "http" or "https"). This value can be influenced with
                   <directive module="core">ServerName</directive>.</dd>
 
+                  <dt><code>REMOTE_ADDR</code></dt>
+                  <dd>The IP address of the remote host (see the
+                  <module>mod_remoteip</module> module).</dd>
+
+                  <dt><code>CONN_REMOTE_ADDR</code></dt>
+                  <dd>Since 2.4.8: The peer IP address of the connection (see the
+                  <module>mod_remoteip</module> module).</dd>
+
                 </dl>
 </note>
         </li>
index d736187715e23d0987d5a18b9cb70e1294f32d61..17e6f22aca5e8503319ae917ec053d6221911a9e 100644 (file)
@@ -2143,7 +2143,10 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
             break;
 
         case 16:
-            if (!strcmp(var, "REQUEST_FILENAME")) {
+            if (*var == 'C' && !strcmp(var, "CONN_REMOTE_ADDR")) {
+                result = r->connection->client_ip;
+            }
+            else if (!strcmp(var, "REQUEST_FILENAME")) {
                 result = r->filename; /* same as script_filename (15) */
             }
             break;