]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Support %{c}h for conn-hostname, %h for useragent_host
authorWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 12 Feb 2016 22:08:29 +0000 (22:08 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 12 Feb 2016 22:08:29 +0000 (22:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1730129 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_config.c

index e961c9300504f8c5943ca33bb1f338a09dc992c2..4351bc507da9b3d64bca6a33b9107415da4df84f 100644 (file)
@@ -339,9 +339,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)