You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/08/05 20:35:30 UTC

svn commit: r1154342 - in /httpd/httpd/trunk: 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

Author: sf
Date: Fri Aug  5 18:35:29 2011
New Revision: 1154342

URL: http://svn.apache.org/viewvc?rev=1154342&view=rev
Log:
mod_proxy_http, mod_proxy_connect: Add 'proxy-status' and 'proxy-source-port'
request notes for logging

PR: 30195

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_proxy_connect.xml
    httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml
    httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1154342&r1=1154341&r2=1154342&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Aug  5 18:35:29 2011
@@ -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]
 

Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy_connect.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy_connect.xml?rev=1154342&r1=1154341&r2=1154342&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy_connect.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy_connect.xml Fri Aug  5 18:35:29 2011
@@ -53,6 +53,18 @@
 </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

Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml?rev=1154342&r1=1154341&r2=1154342&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml Fri Aug  5 18:35:29 2011
@@ -114,4 +114,18 @@
     </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>

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c?rev=1154342&r1=1154341&r2=1154342&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c Fri Aug  5 18:35:29 2011
@@ -376,7 +376,8 @@ static int proxy_connect_handler(request
     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.

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=1154342&r1=1154341&r2=1154342&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Fri Aug  5 18:35:29 2011
@@ -1455,6 +1455,8 @@ apr_status_t ap_proxy_http_process_respo
      * 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_respo
             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;