]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_http, mod_proxy_connect: Add 'proxy-status' and 'proxy-source-port'
authorStefan Fritsch <sf@apache.org>
Fri, 5 Aug 2011 18:35:29 +0000 (18:35 +0000)
committerStefan Fritsch <sf@apache.org>
Fri, 5 Aug 2011 18:35:29 +0000 (18:35 +0000)
request notes for logging

PR: 30195

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1154342 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy_connect.xml
docs/manual/mod/mod_proxy_http.xml
modules/proxy/mod_proxy_connect.c
modules/proxy/mod_proxy_http.c

diff --git a/CHANGES b/CHANGES
index 367f03b16dcf765518080b408da1d46674503b33..611eddfd7e4b82c10e5ea64b843bc0aa288b26ad 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.15
 
+  *) mod_proxy_http, mod_proxy_connect: Add 'proxy-status' and
+     'proxy-source-port' request notes for logging. PR 30195. [Stefan Fritsch]
+
   *) configure: Enable ldap modules in 'all' and 'most' selections if ldap
      is compiled into apr-util. [Stefan Fritsch]
 
index 0cab66b56f504141e105f6d677149128e8dc656a..a6837a794ca998964a63358053149ef641a630c4 100644 (file)
 </summary>
 <seealso><module>mod_proxy</module></seealso>
 
+<section id="notes"><title>Request notes</title>
+    <p><module>mod_proxy_connect</module> creates the following request notes for
+        logging using the <code>%{VARNAME}n</code> format in
+        <directive module="mod_log_config">LogFormat</directive> or
+        <directive module="core">ErrorLogFormat</directive>:
+    </p>
+    <dl>
+        <dt>proxy-source-port</dt>
+        <dd>The local port used for the connection to the backend server.</dd>
+    </dl>
+</section>
+
 <directivesynopsis>
 <name>AllowCONNECT</name>
 <description>Ports that are allowed to <code>CONNECT</code> through the
index a3f283a25c1dbefc0b134c34a7239eaf19f4a52f..163836e67983e1cb4051e2b38a2d92e61fb4d633 100644 (file)
     </dl>
 </section>
 
+<section id="notes"><title>Request notes</title>
+    <p><module>mod_proxy_http</module> creates the following request notes for
+        logging using the <code>%{VARNAME}n</code> format in
+        <directive module="mod_log_config">LogFormat</directive> or
+        <directive module="core">ErrorLogFormat</directive>:
+    </p>
+    <dl>
+        <dt>proxy-source-port</dt>
+        <dd>The local port used for the connection to the backend server.</dd>
+        <dt>proxy-status</dt>
+        <dd>The HTTP status received from the backend server.</dd>
+    </dl>
+</section>
+
 </modulesynopsis>
index 6da0a2d4ddec2deeaf17fd03b61f4573ded07388..e6a3d29ace13559ab3a190b50fd05b5fe10724c7 100644 (file)
@@ -376,7 +376,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
     ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
                   "proxy: CONNECT: connection complete to %pI (%s)",
                   connect_addr, connectname);
-
+    apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu",
+                   backconn->local_addr->port));
 
     /* If we are connecting through a remote proxy, we need to pass
      * the CONNECT request on to it.
index 28026154b6c2c41a84859a8c6d8ed6a660c0215b..940c1f991be40f5d8c32314ff37e54c95b77db42 100644 (file)
@@ -1455,6 +1455,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
      * response.
      */
     backend->r->proxyreq = PROXYREQ_RESPONSE;
+    apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu",
+                   origin->local_addr->port));
     tmp_bb = apr_brigade_create(p, c->bucket_alloc);
     do {
         apr_status_t rc;
@@ -1561,6 +1563,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
             keepchar = buffer[12];
             buffer[12] = '\0';
             proxy_status = atoi(&buffer[9]);
+            apr_table_setn(r->notes, "proxy-status",
+                           apr_pstrdup(r->pool, &buffer[9]));
 
             if (keepchar != '\0') {
                 buffer[12] = keepchar;