From 7221b7a599f7bbfd93cd680b26d3418565c613d4 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Tue, 19 Mar 2019 12:31:23 +0000 Subject: [PATCH] Merge r1730129 from trunk: Support %{c}h for conn-hostname, %h for useragent_host Submitted by: wrowe Reviewed by: jim, ylavic, covener Merge r1818321 from trunk: "{c}h" exists and logs the value returned by 'ap_get_useragent_host()'. I'm not sure of the description to write there, so I just mention it in the doc and hope s.o. will find the words :) This has been introduced in r1730129. Submitted by: jailletc36 Reviewed by: jim, ylavic, covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1855818 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ STATUS | 6 ------ docs/manual/mod/mod_log_config.xml | 5 +++++ modules/loggers/mod_log_config.c | 12 +++++++++--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index f4650581633..6b03eadfa07 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.39 + *) mod_log_config: Support %{c}h for conn-hostname, %h for useragent_host + PR 55348 + + *) mod_socache_redis: Support for Redis as socache storage provider. + *) core: new configuration option 'MergeSlashes on|off' that controls handling of multiple, consecutive slash ('/') characters in the path component of the request URL. [Eric Covener] diff --git a/STATUS b/STATUS index 03a774ae04e..e4b278aab25 100644 --- a/STATUS +++ b/STATUS @@ -126,12 +126,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mod_log_config: Support %{c}h for conn-hostname, %h for useragent_host - PR 55348 - trunk patch: https://svn.apache.org/r1730129 - 2.4.x patch: svn merge -c 1730129 ^/httpd/httpd/trunk . - +1: jim, ylavic, covener - jailletc36: require r1818321 and part of r1818341 to update doc accordingly PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/docs/manual/mod/mod_log_config.xml b/docs/manual/mod/mod_log_config.xml index c7b3543ff6d..6b8419334b3 100644 --- a/docs/manual/mod/mod_log_config.xml +++ b/docs/manual/mod/mod_log_config.xml @@ -111,6 +111,11 @@ href="mod_authz_host.html#reqhost">the Require host documentation. + %{c}h + Like %h, but always reports on the hostname of the + underlying TCP connection and not any modifications to the + remote hostname by modules like mod_remoteip. + %H The request protocol. diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index 4270b3f2411..609de65a4d6 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -309,9 +309,15 @@ static const char *constant_item(request_rec *dummy, char *stuff) static const char *log_remote_host(request_rec *r, char *a) { - return ap_escape_logitem(r->pool, ap_get_remote_host(r->connection, - r->per_dir_config, - REMOTE_NAME, NULL)); + const char *remote_host; + if (a && !strcmp(a, "c")) { + remote_host = ap_get_remote_host(r->connection, r->per_dir_config, + REMOTE_NAME, NULL); + } + else { + remote_host = ap_get_useragent_host(r, REMOTE_NAME, NULL); + } + return ap_escape_logitem(r->pool, remote_host); } static const char *log_remote_address(request_rec *r, char *a) -- 2.47.3