diff --git a/CHANGES b/CHANGES index 367f03b16d..611eddfd7e 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 0cab66b56f..a6837a794c 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 a3f283a25c..163836e679 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 6da0a2d4dd..e6a3d29ace 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 28026154b6..940c1f991b 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;