summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Jagielski <jim@apache.org>2018-08-01 13:27:28 +0200
committerJim Jagielski <jim@apache.org>2018-08-01 13:27:28 +0200
commitc7c68752c8856a73dad940e058ed9e2737bf9d10 (patch)
tree86af11fc7a2764223776df049074285b7e342f9c
parentspelling (diff)
downloadapache2-c7c68752c8856a73dad940e058ed9e2737bf9d10.tar.xz
apache2-c7c68752c8856a73dad940e058ed9e2737bf9d10.zip
Fix PR54848 in a 2.4.x backportable format. Ideally deprecating the use
of ->client in whatever version of 2.4 this is added into would be more logical. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837225 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--include/scoreboard.h3
-rw-r--r--modules/echo/mod_echo.c4
-rw-r--r--modules/experimental/mod_noloris.c4
-rw-r--r--modules/generators/mod_status.c4
-rw-r--r--modules/lua/lua_request.c4
-rw-r--r--server/scoreboard.c25
7 files changed, 32 insertions, 16 deletions
diff --git a/CHANGES b/CHANGES
index c7867bf9e8..c1fb11d58c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -551,7 +551,9 @@ Changes with Apache 2.5.0-alpha
*) mod_status, mod_echo: Fix the display of client addresses.
They were truncated to 31 characters which is not enough for IPv6 addresses.
- PR 54848 [Bernhard Schmidt <berni birkenwald de>]
+ This is done by deprecating the use of the 'client' field and using
+ the new 'client64' field in worker_score.
+ PR 54848 [Bernhard Schmidt <berni birkenwald de>, Jim Jagielski]
*) core: merge AllowEncodedSlashes from the base configuration into
virtual hosts. [Eric Covener]
diff --git a/include/scoreboard.h b/include/scoreboard.h
index 015aec97b8..42b04d1ee7 100644
--- a/include/scoreboard.h
+++ b/include/scoreboard.h
@@ -112,10 +112,11 @@ struct worker_score {
#ifdef HAVE_TIMES
struct tms times;
#endif
- char client[40]; /* Keep 'em small... but large enough to hold an IPv6 address */
+ char client[32]; /* DEPRECATED: Keep 'em small... */
char request[64]; /* We just want an idea... */
char vhost[32]; /* What virtual host is being accessed? */
char protocol[16]; /* What protocol is used on the connection? */
+ char client64[64];
};
typedef struct {
diff --git a/modules/echo/mod_echo.c b/modules/echo/mod_echo.c
index 336f90f3fa..c7f2a19d92 100644
--- a/modules/echo/mod_echo.c
+++ b/modules/echo/mod_echo.c
@@ -108,10 +108,10 @@ static int update_echo_child_status(ap_sb_handle_t *sbh,
/* initial pass only, please - in the name of efficiency */
if (c) {
- apr_cpystrn(ws->client,
+ apr_cpystrn(ws->client64,
ap_get_remote_host(c, c->base_server->lookup_defaults,
REMOTE_NOLOOKUP, NULL),
- sizeof(ws->client));
+ sizeof(ws->client64));
apr_cpystrn(ws->vhost, c->base_server->server_hostname,
sizeof(ws->vhost));
/* Deliberate trailing space - filling in string on WRITE passes */
diff --git a/modules/experimental/mod_noloris.c b/modules/experimental/mod_noloris.c
index 4f923dbe4b..5170a48c7b 100644
--- a/modules/experimental/mod_noloris.c
+++ b/modules/experimental/mod_noloris.c
@@ -122,13 +122,13 @@ static int noloris_monitor(apr_pool_t *pool, server_rec *s)
for (j = 0; j < thread_limit; ++j) {
ws = ap_get_scoreboard_worker_from_indexes(i, j);
if (ws->status == SERVER_BUSY_READ) {
- n = apr_hash_get(connections, ws->client, APR_HASH_KEY_STRING);
+ n = apr_hash_get(connections, ws->client64, APR_HASH_KEY_STRING);
if (n == NULL) {
n = totals + index++;
*n = 0;
}
++*n;
- apr_hash_set(connections, ws->client, APR_HASH_KEY_STRING, n);
+ apr_hash_set(connections, ws->client64, APR_HASH_KEY_STRING, n);
}
}
}
diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c
index 12801f94ce..3b89350321 100644
--- a/modules/generators/mod_status.c
+++ b/modules/generators/mod_status.c
@@ -801,7 +801,7 @@ static int status_handler(request_rec *r)
ap_rprintf(r,
" <i>%s {%s}</i> <i>(%s)</i> <b>[%s]</b><br />\n\n",
ap_escape_html(r->pool,
- ws_record->client),
+ ws_record->client64),
ap_escape_html(r->pool,
ap_escape_logitem(r->pool,
ws_record->request)),
@@ -888,7 +888,7 @@ static int status_handler(request_rec *r)
ap_rprintf(r, "</td><td>%s</td><td>%s</td><td nowrap>%s</td>"
"<td nowrap>%s</td></tr>\n\n",
ap_escape_html(r->pool,
- ws_record->client),
+ ws_record->client64),
ap_escape_html(r->pool,
ws_record->protocol),
ap_escape_html(r->pool,
diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c
index 6349dba2d0..7a901fd7ff 100644
--- a/modules/lua/lua_request.c
+++ b/modules/lua/lua_request.c
@@ -1275,6 +1275,10 @@ static int lua_ap_scoreboard_worker(lua_State *L)
lua_pushstring(L, ws_record->client);
lua_settable(L, -3);
+ lua_pushstring(L, "client64");
+ lua_pushstring(L, ws_record->client64);
+ lua_settable(L, -3);
+
lua_pushstring(L, "conn_bytes");
lua_pushnumber(L, (lua_Number) ws_record->conn_bytes);
lua_settable(L, -3);
diff --git a/server/scoreboard.c b/server/scoreboard.c
index 4eb1b05890..3e200a1a96 100644
--- a/server/scoreboard.c
+++ b/server/scoreboard.c
@@ -523,17 +523,25 @@ static int update_child_status_internal(int child_num,
}
if (r && r->useragent_ip) {
- if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
- apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
- else
- apr_cpystrn(ws->client, val, sizeof(ws->client));
+ if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL))) {
+ apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client)); /* DEPRECATE */
+ apr_cpystrn(ws->client64, r->useragent_ip, sizeof(ws->client64));
+ }
+ else {
+ apr_cpystrn(ws->client, val, sizeof(ws->client)); /* DEPRECATE */
+ apr_cpystrn(ws->client64, val, sizeof(ws->client64));
+ }
}
else if (c) {
if (!(val = ap_get_remote_host(c, c->base_server->lookup_defaults,
- REMOTE_NOLOOKUP, NULL)))
- apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client));
- else
- apr_cpystrn(ws->client, val, sizeof(ws->client));
+ REMOTE_NOLOOKUP, NULL))) {
+ apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client)); /* DEPRECATE */
+ apr_cpystrn(ws->client64, c->client_ip, sizeof(ws->client64));
+ }
+ else {
+ apr_cpystrn(ws->client, val, sizeof(ws->client)); /* DEPRECATE */
+ apr_cpystrn(ws->client64, val, sizeof(ws->client64));
+ }
}
if (s) {
@@ -665,6 +673,7 @@ AP_DECLARE(void) ap_copy_scoreboard_worker(worker_score *dest,
/* For extra safety, NUL-terminate the strings returned, though it
* should be true those last bytes are always zero anyway. */
dest->client[sizeof(dest->client) - 1] = '\0';
+ dest->client64[sizeof(dest->client64) - 1] = '\0';
dest->request[sizeof(dest->request) - 1] = '\0';
dest->vhost[sizeof(dest->vhost) - 1] = '\0';
dest->protocol[sizeof(dest->protocol) - 1] = '\0';