From 7cc67a8c39ff7c67aa79d1a9516a39fd018a51aa Mon Sep 17 00:00:00 2001
From: Jeff Trawick <trawick@apache.org>
Date: Fri, 18 Nov 2011 13:10:06 +0000
Subject: [PATCH] add conn_rec to error log hook

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203634 13f79535-47bb-0310-9956-ffa450edef68
---
 CHANGES            |  2 ++
 include/ap_mmn.h   |  1 +
 include/http_log.h |  5 +++--
 server/log.c       | 10 +++++-----
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/CHANGES b/CHANGES
index 5ef4bfc251..93fe42fb77 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) error log hook: add conn_rec as a parameter.  [Jeff Trawick]
+
   *) mod_ssl: drop support for the SSLv2 protocol. [Kaspar Brand]
 
   *) mod_lua: Stop losing track of all but the most specific LuaHook* directives
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
index dac9c1f511..afc7955553 100644
--- a/include/ap_mmn.h
+++ b/include/ap_mmn.h
@@ -365,6 +365,7 @@
  * 20111025.1 (2.3.15-dev) Add ap_escape_urlencoded(), ap_escape_urlencoded_buffer()
  *                         and ap_unescape_urlencoded().
  * 20111025.2 (2.3.15-dev) Add ap_lua_ssl_val to mod_lua
+ * 20111118.0 (2.5.0-dev)  Add conn_rec to error_log hook
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
diff --git a/include/http_log.h b/include/http_log.h
index 6a1717bb37..038feebd5f 100644
--- a/include/http_log.h
+++ b/include/http_log.h
@@ -633,6 +633,7 @@ AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl);
  * @param level The level of this error message
  * @param status The status code from the previous command
  * @param s The server which we are logging for
+ * @param c The connection which we are logging for
  * @param r The request which we are logging for
  * @param pool Memory pool to allocate from
  * @param errstr message to log
@@ -640,8 +641,8 @@ AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl);
 AP_DECLARE_HOOK(void, error_log, (const char *file, int line,
                        int module_index, int level,
                        apr_status_t status, const server_rec *s,
-                       const request_rec *r, apr_pool_t *pool,
-                       const char *errstr))
+                       const conn_rec *c, const request_rec *r,
+                       apr_pool_t *pool, const char *errstr))
 
 /**
  * hook method to generate unique id for connection or request
diff --git a/server/log.c b/server/log.c
index 9fe76047be..a3b294cce1 100644
--- a/server/log.c
+++ b/server/log.c
@@ -1264,8 +1264,8 @@ static void log_error_core(const char *file, int line, int module_index,
         if (!log_format) {
             /* only pass the real error string to the hook */
             errstr[errstr_end] = '\0';
-            ap_run_error_log(file, line, module_index, level, status, s, r, pool,
-                             errstr + errstr_start);
+            ap_run_error_log(file, line, module_index, level, status, s, c, r,
+                             pool, errstr + errstr_start);
         }
 
         *errstr = '\0';
@@ -1761,9 +1761,9 @@ AP_DECLARE(const char *) ap_parse_log_level(const char *str, int *val)
 AP_IMPLEMENT_HOOK_VOID(error_log,
                        (const char *file, int line, int module_index, int level,
                         apr_status_t status, const server_rec *s,
-                        const request_rec *r, apr_pool_t *pool,
-                        const char *errstr), (file, line, module_index, level,
-                        status, s, r, pool, errstr))
+                        const conn_rec *c, const request_rec *r,
+                        apr_pool_t *pool, const char *errstr), (file, line,
+                        module_index, level, status, s, c, r, pool, errstr))
 
 AP_IMPLEMENT_HOOK_RUN_FIRST(int, generate_log_id,
                             (const conn_rec *c, const request_rec *r,
-- 
2.40.0