]> granicus.if.org Git - apache/commitdiff
allow two character mod_log_config formats
authorEric Covener <covener@apache.org>
Tue, 15 Jul 2014 13:30:59 +0000 (13:30 +0000)
committerEric Covener <covener@apache.org>
Tue, 15 Jul 2014 13:30:59 +0000 (13:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610686 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/loggers/mod_log_config.c

diff --git a/CHANGES b/CHANGES
index 8bb4974e20cca757a7d792f2cfae898b5723ad88..973c3748cf9a774d9944f14f33ed81f33fc65f4e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_log_config: Allow two character log formats to be registered and used.
+     [Eric Covener]
+
   *) mod_ssl: Extend the scope of SSLSessionCacheTimeout to sessions
      resumed by TLS session resumption (RFC 5077). [Rainer Jung]
 
index 8313af68a049be464f384295d5913528e12c19c6..624165146e0c5d6d65c688e5fb598a6f49e2cb12 100644 (file)
@@ -917,7 +917,7 @@ static char *parse_log_misc_string(apr_pool_t *p, log_format_item *it,
 static char *parse_log_item(apr_pool_t *p, log_format_item *it, const char **sa)
 {
     const char *s = *sa;
-    ap_log_handler *handler;
+    ap_log_handler *handler = NULL;
 
     if (*s != '%') {
         return parse_log_misc_string(p, it, sa);
@@ -987,7 +987,16 @@ static char *parse_log_item(apr_pool_t *p, log_format_item *it, const char **sa)
             break;
 
         default:
-            handler = (ap_log_handler *)apr_hash_get(log_hash, s++, 1);
+            /* check for exactly two character format first */
+            if (*(s+1)) { 
+                handler = (ap_log_handler *)apr_hash_get(log_hash, s, 2); 
+                if (handler) { 
+                   s += 2;
+                }
+            }
+            if (!handler) {  
+                handler = (ap_log_handler *)apr_hash_get(log_hash, s++, 1);  
+            }
             if (!handler) {
                 char dummy[2];
 
@@ -1550,7 +1559,7 @@ static void ap_register_log_handler(apr_pool_t *p, char *tag,
     log_struct->func = handler;
     log_struct->want_orig_default = def;
 
-    apr_hash_set(log_hash, tag, 1, (const void *)log_struct);
+    apr_hash_set(log_hash, tag, strlen(tag), (const void *)log_struct);
 }
 static ap_log_writer_init *ap_log_set_writer_init(ap_log_writer_init *handle)
 {