-*- coding: utf-8 -*-
Changes with Apache 2.2.11
+ *) Add new LogFormat parameter, %k, which logs the number of
+ keepalive requests on this connection for this request.
+ PR 45762 [Dan Poirier <poirier pobox.com>, Jim Jagielski]
+
*) Export and install the mod_rewrite.h header to ensure the optional
rewrite_mapfunc_t and ap_register_rewrite_mapfunc functions are
available to third party modules. [Graham Leggett]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_log_config: Add in useful feature, %k which logs the keepalives
- value. PR: 45762
- Trunk version of patch:
- http://svn.apache.org/viewvc?view=rev&revision=693120
- http://svn.apache.org/viewvc?view=rev&revision=720250
- Backport version for 2.2.x of patch:
- Trunk version of patch works (minus CHANGES conflict)
- +1: jim, rpluem, pgolluci
* srclib/pcre and vendor/pcre
http://www.vuxml.org/freebsd/pkg-pcre.html
modules (e.g. <module>mod_headers</module>) affect this.
</td></tr>
+ <tr><td><code>%k</code></td>
+ <td>Number of keepalive requests handled on this connection. Interesting if
+ <directive module="core">KeepAlive</directive> is being used;
+ otherwise this is always 0.</td></tr>
+
<tr><td><code>%l</code></td>
<td>Remote logname (from identd, if supplied). This will return a
dash unless <module>mod_ident</module> is present and <directive
AP_DECLARE(int) ap_set_keepalive(request_rec *r)
{
int ka_sent = 0;
+ int left = r->server->keep_alive_max - r->connection->keepalives;
int wimpy = ap_find_token(r->pool,
apr_table_get(r->headers_out, "Connection"),
"close");
&& r->server->keep_alive
&& (r->server->keep_alive_timeout > 0)
&& ((r->server->keep_alive_max == 0)
- || (r->server->keep_alive_max > r->connection->keepalives))
+ || (left > 0))
&& !ap_status_drops_connection(r->status)
&& !wimpy
&& !ap_find_token(r->pool, conn, "close")
&& ((ka_sent = ap_find_token(r->pool, conn, "keep-alive"))
|| (r->proto_num >= HTTP_VERSION(1,1)))
&& !ap_graceful_stop_signalled()) {
- int left = r->server->keep_alive_max - r->connection->keepalives;
r->connection->keepalive = AP_CONN_KEEPALIVE;
r->connection->keepalives++;
apr_table_mergen(r->headers_out, "Connection", "close");
}
+ /*
+ * If we had previously been a keepalive connection and this
+ * is the last one, then bump up the number of keepalives
+ * we've had
+ */
+ if ((r->connection->keepalive != AP_CONN_CLOSE)
+ && r->server->keep_alive_max
+ && !left) {
+ r->connection->keepalives++;
+ }
r->connection->keepalive = AP_CONN_CLOSE;
return 0;
* %...A: local IP-address
* %...{Foobar}i: The contents of Foobar: header line(s) in the request
* sent to the client.
+ * %...k: number of keepalive requests served over this connection
* %...l: remote logname (from identd, if supplied)
* %...{Foobar}n: The contents of note "Foobar" from another module.
* %...{Foobar}o: The contents of Foobar: header line(s) in the reply.
return "-";
}
+static const char *log_requests_on_connection(request_rec *r, char *a)
+{
+ int num = r->connection->keepalives ? r->connection->keepalives - 1 : 0;
+ return apr_itoa(r->pool, num);
+}
+
/*****************************************************************
*
* Parsing the log format string
log_pfn_register(p, "q", log_request_query, 0);
log_pfn_register(p, "X", log_connection_status, 0);
log_pfn_register(p, "C", log_cookie, 0);
+ log_pfn_register(p, "k", log_requests_on_connection, 0);
log_pfn_register(p, "r", log_request_line, 1);
log_pfn_register(p, "D", log_request_duration_microseconds, 1);
log_pfn_register(p, "T", log_request_duration, 1);