From: Bill Stoddard Date: Fri, 3 Nov 2000 01:31:37 +0000 (+0000) Subject: Add a new LogFormat directive, %c, that will log connection X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=028679a000c407151dcd8436aad41fb1c18cb19f;p=apache Add a new LogFormat directive, %c, that will log connection 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 --- diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index b5cc19fb27..e2813fe606 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -119,6 +119,10 @@ * 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' }