1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

mod_proxy_http, mod_proxy_connect: Add 'proxy-status' and 'proxy-source-port'

request notes for logging

PR: 30195


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1154342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2011-08-05 18:35:29 +00:00
parent 2c2e7cf837
commit 24e349de03
5 changed files with 35 additions and 1 deletions

View File

@@ -2,6 +2,9 @@
Changes with Apache 2.3.15 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 *) configure: Enable ldap modules in 'all' and 'most' selections if ldap
is compiled into apr-util. [Stefan Fritsch] is compiled into apr-util. [Stefan Fritsch]

View File

@@ -53,6 +53,18 @@
</summary> </summary>
<seealso><module>mod_proxy</module></seealso> <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> <directivesynopsis>
<name>AllowCONNECT</name> <name>AllowCONNECT</name>
<description>Ports that are allowed to <code>CONNECT</code> through the <description>Ports that are allowed to <code>CONNECT</code> through the

View File

@@ -114,4 +114,18 @@
</dl> </dl>
</section> </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> </modulesynopsis>

View 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, ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
"proxy: CONNECT: connection complete to %pI (%s)", "proxy: CONNECT: connection complete to %pI (%s)",
connect_addr, connectname); 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 /* If we are connecting through a remote proxy, we need to pass
* the CONNECT request on to it. * the CONNECT request on to it.

View File

@@ -1455,6 +1455,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
* response. * response.
*/ */
backend->r->proxyreq = PROXYREQ_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); tmp_bb = apr_brigade_create(p, c->bucket_alloc);
do { do {
apr_status_t rc; 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]; keepchar = buffer[12];
buffer[12] = '\0'; buffer[12] = '\0';
proxy_status = atoi(&buffer[9]); proxy_status = atoi(&buffer[9]);
apr_table_setn(r->notes, "proxy-status",
apr_pstrdup(r->pool, &buffer[9]));
if (keepchar != '\0') { if (keepchar != '\0') {
buffer[12] = keepchar; buffer[12] = keepchar;