Commit 53543c72 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r693120, r720250 from trunk:

Add in useful feature. %k which logs the keepalives
value.
PR: 45762
        Dan Poirier <poirier@pobox.com>


Make %k work as it should. No regression noted in perl
test framework.

Reviewed by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@721033 13f79535-47bb-0310-9956-ffa450edef68
parent 466108f4
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
                                                         -*- 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]
+0 −8
Changes for STATUS: 0 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -85,14 +85,6 @@ RELEASE SHOWSTOPPERS:

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
+5 −0
Changes for docs/manual/mod/mod_log_config.xml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -109,6 +109,11 @@
        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
+12 −2
Changes for modules/http/http_protocol.c: 12 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ AP_IMPLEMENT_HOOK_VOID(insert_error_filter, (request_rec *r), (r))
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");
@@ -207,7 +208,7 @@ AP_DECLARE(int) ap_set_keepalive(request_rec *r)
        && 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")
@@ -216,7 +217,6 @@ AP_DECLARE(int) ap_set_keepalive(request_rec *r)
        && ((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++;
@@ -252,6 +252,16 @@ AP_DECLARE(int) ap_set_keepalive(request_rec *r)
        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;
+8 −0
Changes for modules/loggers/mod_log_config.c: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@
 * %...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.
@@ -699,6 +700,12 @@ static const char *log_connection_status(request_rec *r, char *a)
    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
@@ -1503,6 +1510,7 @@ static int log_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
        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);