From: Jim Jagielski Date: Mon, 10 Feb 2014 18:54:23 +0000 (+0000) Subject: Merge r1563418 from trunk: X-Git-Tag: 2.4.8~126 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fc9c99feb30d6d1dc66eb9b93df5eb2230e3c81;p=apache Merge r1563418 from trunk: Add %{CONN_REMOTE_ADDR} to mod_rewrite. PR56094 Submitted By: Edward Lu Committed By: covener Submitted by: covener Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1566702 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index c2c9aa01da..8692db89d5 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.8 + *) mod_rewrite: Add %{CONN_REMOTE_ADDR} as the non-useragent counterpart to + %{REMOTE_ADDR}. PR 56094. [Edward Lu ] + *) WinNT MPM: If ap_run_pre_connection() fails or sets c->aborted, don't save the socket for reuse by the next worker as if it were an APR_SO_DISCONNECTED socket. Restores 2.2 behavior. [Eric Covener] diff --git a/STATUS b/STATUS index e682ead455..521fffe63b 100644 --- a/STATUS +++ b/STATUS @@ -98,13 +98,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_rewrite: Add %{CONN_REMOTE_ADDR} to mod_rewrite PR56094 - trunk patch: https://svn.apache.org/r1563418 - 2.4.x patch: trunk works - +1: covener, jim, mrumph - mrumph: Verified the change against comment 1 in PR 55886. - Also, verified the source change against log_remote_address() - in modules/loggers/mod_log_config.c in both trunk and 2.4.x. PATCHES PROPOSED TO BACKPORT FROM TRUNK: diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index 4e7a54fea6..2c76a94efa 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -446,6 +446,7 @@ Alias /myapp /opt/myapp-1.2.3 REMOTE_ADDR
+ CONN_REMOTE_ADDR
REMOTE_HOST
REMOTE_PORT
REMOTE_USER
@@ -574,6 +575,14 @@ Alias /myapp /opt/myapp-1.2.3 "http" or "https"). This value can be influenced with ServerName. +
REMOTE_ADDR
+
The IP address of the remote host (see the + mod_remoteip module).
+ +
CONN_REMOTE_ADDR
+
Since 2.4.8: The peer IP address of the connection (see the + mod_remoteip module).
+ diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 9a63bdc1b5..e1903e5cba 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -2139,7 +2139,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;