]> granicus.if.org Git - apache/commitdiff
Add a new LogFormat directive, %c, that will log connection
authorBill Stoddard <stoddard@apache.org>
Fri, 3 Nov 2000 01:31:37 +0000 (01:31 +0000)
committerBill Stoddard <stoddard@apache.org>
Fri, 3 Nov 2000 01:31:37 +0000 (01:31 +0000)
status at the end of the response as follows:
 'X' - connection aborted before the response completed.
 '+' - connection may be kept-alive by the server.
 '-' - connection will be closed by the server.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86814 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_config.c

index b5cc19fb27393a6c5f4ca9e2b5647d233addd26b..e2813fe606871c1483c9e10cf607d0f0dff5fa64 100644 (file)
  * follows:
  *
  * %...b:  bytes sent, excluding HTTP headers.
+ * %...c:  Status of the connection.
+ *         'X' = connection aborted before the response completed.
+ *         '+' = connection may be kept alive after the response is sent.
+ *         '-' = connection will be closed after the response is sent.
  * %...{FOOBAR}e:  The contents of the environment variable FOOBAR
  * %...f:  filename
  * %...h:  remote host
@@ -463,7 +467,18 @@ static const char *log_child_pid(request_rec *r, char *a)
 {
     return apr_psprintf(r->pool, "%ld", (long) getpid());
 }
+static const char *log_connection_status(request_rec *r, char *a)
+{
+    if (r->connection->aborted)
+        return "X";
+
+    if ((r->connection->keepalive) &&
+        ((r->server->keep_alive_max - r->connection->keepalives) > 0)) {
+        return "+";
+    }
 
+    return "-";
+}
 /*****************************************************************
  *
  * Parsing the log format string
@@ -535,6 +550,9 @@ static struct log_item_list {
     {
         'P', log_child_pid, 0
     },
+    {
+        'c', log_connection_status, 0
+    },
     {
         '\0'
     }