]> granicus.if.org Git - apache/commitdiff
PR59938: add %{REMOTE_PORT} to the expression parser
authorEric Covener <covener@apache.org>
Thu, 29 Dec 2016 18:31:13 +0000 (18:31 +0000)
committerEric Covener <covener@apache.org>
Thu, 29 Dec 2016 18:31:13 +0000 (18:31 +0000)
Submitted By: Hank Ibell <hwibell gmail.com>

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

CHANGES
docs/manual/expr.xml
server/util_expr_eval.c

diff --git a/CHANGES b/CHANGES
index 1de27cba17afad9f34aee63e280a981924e06525..a5f089c6e9ac1fbdbfbc001875ff07120d9d81b4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
+  *) core: Add %{REMOTE_PORT} to the expression parser. PR59938
+     [Hank Ibell <hwibell gmail.com>]
 
   *) mod_remoteip: When overriding the useragent address from X-Forwarded-For,
      zero out what had been initialized as the connection-level port.  PR59931.
index 159142f5e054a1bd48aa5c36610b2b74267a70ea..17a36c6b0067f189f84352630c930291892c87c1 100644 (file)
@@ -230,6 +230,8 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
             "<code>GET /index.html HTTP/1.1</code>")</td></tr>
     <tr><td><code>REMOTE_ADDR</code></td>
         <td>The IP address of the remote host</td></tr>
+    <tr><td><code>REMOTE_PORT</code></td>
+        <td>The port of the remote host</td></tr>
     <tr><td><code>REMOTE_HOST</code></td>
         <td>The host name of the remote host</td></tr>
     <tr><td><code>REMOTE_USER</code></td>
index 7d2f2669ac2d257dfb139a77087e3dcdce5806ff..e08c4d2ac1952bea4253902b8ce8375845f8a0c5 100644 (file)
@@ -1456,6 +1456,7 @@ static const char *request_var_names[] = {
     "SERVER_PROTOCOL_VERSION",  /* 29 */
     "SERVER_PROTOCOL_VERSION_MAJOR",  /* 30 */
     "SERVER_PROTOCOL_VERSION_MINOR",  /* 31 */
+    "REMOTE_PORT",                    /* 32 */
     NULL
 };
 
@@ -1562,6 +1563,8 @@ static const char *request_var_fn(ap_expr_eval_ctx_t *ctx, const void *data)
         case 9:     return "9";
         }
         return apr_psprintf(ctx->p, "%d", HTTP_VERSION_MINOR(r->proto_num));
+    case 32:
+        return apr_psprintf(ctx->p, "%u", ctx->c->client_addr->port);
     default:
         ap_assert(0);
         return NULL;