From: Yann Ylavic Date: Tue, 28 Mar 2017 21:30:09 +0000 (+0000) Subject: Merge r1776459, r1788508 from trunk: X-Git-Tag: 2.4.26~205 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ad19e9839573e1aef3e9df80dcfdfe63e117f77;p=apache Merge r1776459, r1788508 from trunk: PR59938: add %{REMOTE_PORT} to the expression parser Submitted By: Hank Ibell compat note for REMOTE_PORT Submitted by: covener Reviewed by: covener, ylavic, jchampion git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1789244 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index ca67dd5209..a9336a34ce 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.26 + *) core: Add %{REMOTE_PORT} to the expression parser. PR59938 + [Hank Ibell ] + *) mod_cache: Fix a regression in 2.4.25 for the forward proxy case by computing and using the same entity key according to when the cache checks, loads and saves the request. diff --git a/STATUS b/STATUS index 62b1ed771a..c31352e75e 100644 --- a/STATUS +++ b/STATUS @@ -118,14 +118,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) core: Add %{REMOTE_PORT} to the expression parser. PR59938 - trunk patch: http://svn.apache.org/r1776459 - http://svn.apache.org/r1788508 - 2.4.x patch: trunk works - +1: covener, ylavic, jchampion - jchampion: Trunk patches don't apply cleanly for me. The patch I used to - test is at https://home.apache.org/~jchampion/patches/2.4.x-expr-REMOTE_PORT.patch - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index 2572beac7e..2ac7481146 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -225,6 +225,8 @@ listfunction ::= listfuncname "(" word ")" "GET /index.html HTTP/1.1") REMOTE_ADDR The IP address of the remote host + REMOTE_PORT + The port of the remote host (2.4.26 and later) REMOTE_HOST The host name of the remote host REMOTE_USER diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 6659ea62a2..b1cb9235d1 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -1337,6 +1337,7 @@ static const char *request_var_names[] = { "CONTEXT_DOCUMENT_ROOT", /* 26 */ "REQUEST_STATUS", /* 27 */ "REMOTE_ADDR", /* 28 */ + "REMOTE_PORT", /* 29 */ NULL }; @@ -1426,6 +1427,8 @@ static const char *request_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) return r->status ? apr_psprintf(ctx->p, "%d", r->status) : ""; case 28: return r->useragent_ip; + case 29: + return apr_psprintf(ctx->p, "%u", ctx->c->client_addr->port); default: ap_assert(0); return NULL;