httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r721033 - in /httpd/httpd/branches/2.2.x: ./ CHANGES STATUS docs/ docs/manual/mod/mod_log_config.xml modules/http/http_protocol.c modules/loggers/mod_log_config.c support/ab.c support/suexec.c
Date Wed, 26 Nov 2008 23:24:20 GMT
Author: jim
Date: Wed Nov 26 15:24:20 2008
New Revision: 721033

URL: http://svn.apache.org/viewvc?rev=721033&view=rev
Log:
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

Modified:
    httpd/httpd/branches/2.2.x/   (props changed)
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/   (props changed)
    httpd/httpd/branches/2.2.x/docs/manual/mod/mod_log_config.xml
    httpd/httpd/branches/2.2.x/modules/http/http_protocol.c
    httpd/httpd/branches/2.2.x/modules/loggers/mod_log_config.c
    httpd/httpd/branches/2.2.x/support/ab.c   (props changed)
    httpd/httpd/branches/2.2.x/support/suexec.c   (props changed)

Propchange: httpd/httpd/branches/2.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 26 15:24:20 2008
@@ -1 +1 @@
-/httpd/httpd/trunk:451572,611483,639005,639010,647395,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,719357
+/httpd/httpd/trunk:451572,611483,639005,639010,647395,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,719357,720250

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=721033&r1=721032&r2=721033&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Wed Nov 26 15:24:20 2008
@@ -1,6 +1,10 @@
                                                          -*- 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]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=721033&r1=721032&r2=721033&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Wed Nov 26 15:24:20 2008
@@ -85,14 +85,6 @@
 
 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

Propchange: httpd/httpd/branches/2.2.x/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 26 15:24:20 2008
@@ -1 +1 @@
-/httpd/httpd/trunk/docs:451572,611483,639005,639010,647395,660461,660566,664330,675610,678761,681190,682369,683626,684351,685112,686549,686805,686809,687099,687754,692325,693120,693392,693727-693728,696006,697093,703441,703997,706318,707163,708902,711421,719357
+/httpd/httpd/trunk/docs:451572,611483,639005,639010,647395,660461,660566,664330,675610,678761,681190,682369,683626,684351,685112,686549,686805,686809,687099,687754,692325,693120,693392,693727-693728,696006,697093,703441,703997,706318,707163,708902,711421,719357,720250

Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/mod_log_config.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/mod_log_config.xml?rev=721033&r1=721032&r2=721033&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/mod/mod_log_config.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/mod/mod_log_config.xml Wed Nov 26 15:24:20 2008
@@ -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

Modified: httpd/httpd/branches/2.2.x/modules/http/http_protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/http/http_protocol.c?rev=721033&r1=721032&r2=721033&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/http/http_protocol.c (original)
+++ httpd/httpd/branches/2.2.x/modules/http/http_protocol.c Wed Nov 26 15:24:20 2008
@@ -162,6 +162,7 @@
 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 @@
         && 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 @@
         && ((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 @@
         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;

Modified: httpd/httpd/branches/2.2.x/modules/loggers/mod_log_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/loggers/mod_log_config.c?rev=721033&r1=721032&r2=721033&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/loggers/mod_log_config.c (original)
+++ httpd/httpd/branches/2.2.x/modules/loggers/mod_log_config.c Wed Nov 26 15:24:20 2008
@@ -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 @@
     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 @@
         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);

Propchange: httpd/httpd/branches/2.2.x/support/ab.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 26 15:24:20 2008
@@ -1 +1 @@
-/httpd/httpd/trunk/support/ab.c:83751-655654,657433,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,719357
+/httpd/httpd/trunk/support/ab.c:83751-655654,657433,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,719357,720250

Propchange: httpd/httpd/branches/2.2.x/support/suexec.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 26 15:24:20 2008
@@ -1 +1 @@
-/httpd/httpd/trunk/support/suexec.c:451572,611483,639005,639010,647395,655711,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,719357
+/httpd/httpd/trunk/support/suexec.c:451572,611483,639005,639010,647395,655711,660461,660566,664330,678761,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,719357,720250



Mime
View raw message