From: Stefan Fritsch Date: Fri, 5 Aug 2011 18:35:29 +0000 (+0000) Subject: mod_proxy_http, mod_proxy_connect: Add 'proxy-status' and 'proxy-source-port' X-Git-Tag: 2.3.15~409 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24e349de0361fc23f08c9430c69166616b730ff2;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/CHANGES b/CHANGES index 367f03b16dc..611eddfd7e4 100644 --- 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] diff --git a/docs/manual/mod/mod_proxy_connect.xml b/docs/manual/mod/mod_proxy_connect.xml index 0cab66b56f5..a6837a794ca 100644 --- a/docs/manual/mod/mod_proxy_connect.xml +++ b/docs/manual/mod/mod_proxy_connect.xml @@ -53,6 +53,18 @@ mod_proxy +
Request notes +

mod_proxy_connect creates the following request notes for + logging using the %{VARNAME}n format in + LogFormat or + ErrorLogFormat: +

+
+
proxy-source-port
+
The local port used for the connection to the backend server.
+
+
+ AllowCONNECT Ports that are allowed to CONNECT through the diff --git a/docs/manual/mod/mod_proxy_http.xml b/docs/manual/mod/mod_proxy_http.xml index a3f283a25c1..163836e6798 100644 --- a/docs/manual/mod/mod_proxy_http.xml +++ b/docs/manual/mod/mod_proxy_http.xml @@ -114,4 +114,18 @@ +
Request notes +

mod_proxy_http creates the following request notes for + logging using the %{VARNAME}n format in + LogFormat or + ErrorLogFormat: +

+
+
proxy-source-port
+
The local port used for the connection to the backend server.
+
proxy-status
+
The HTTP status received from the backend server.
+
+
+ diff --git a/modules/proxy/mod_proxy_connect.c b/modules/proxy/mod_proxy_connect.c index 6da0a2d4dde..e6a3d29ace1 100644 --- a/modules/proxy/mod_proxy_connect.c +++ b/modules/proxy/mod_proxy_connect.c @@ -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. diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 28026154b6c..940c1f991be 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -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;