From 33a05f1bf16a164b136b3a1d899e63f716b8a33a Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Fri, 26 Sep 2014 10:56:39 +0000 Subject: [PATCH] Merge r1624349 from trunk: mod_status should honor remote_ip as documented Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1627744 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ STATUS | 6 ------ server/scoreboard.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 4d864ac4be..bbb38da2ad 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.11 + *) mod_status: Honor client IP address using mod_remoteip. PR 55886. + [Jim Jagielski] + *) cmake-based build for Windows: Fix incompatibility with cmake 2.8.12 and later. PR 56615. [Chuck Liu , Jeff Trawick] diff --git a/STATUS b/STATUS index dcd9df4ae7..939c179f9e 100644 --- a/STATUS +++ b/STATUS @@ -102,12 +102,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_status: honor mod_remoteip. - trunk patch: http://svn.apache.org/r1624349 - 2.4.x patch: trunk patch works - +1: jim, jkaluza, mrumph - mrumph: This fix should be credited to bug 55886. - * mod_cache: Avoid sending a 304 to an unconditional request during a revalidation. PR56881 trunk patch: http://svn.apache.org/r1619835 diff --git a/server/scoreboard.c b/server/scoreboard.c index d971e9bf1c..73bdccdd42 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -484,8 +484,14 @@ static int update_child_status_internal(int child_num, ws->conn_bytes = 0; } if (r) { - apr_cpystrn(ws->client, ap_get_remote_host(c, r->per_dir_config, - REMOTE_NOLOOKUP, NULL), sizeof(ws->client)); + const char *client = ap_get_remote_host(c, r->per_dir_config, + REMOTE_NOLOOKUP, NULL); + if (!client || !strcmp(client, c->client_ip)) { + apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client)); + } + else { + apr_cpystrn(ws->client, client, sizeof(ws->client)); + } copy_request(ws->request, sizeof(ws->request), r); if (r->server) { apr_snprintf(ws->vhost, sizeof(ws->vhost), "%s:%d", -- 2.40.0