From 92023763f1e20e3e36151dafd4d81014e230907e Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Thu, 8 Oct 2009 21:42:13 +0000 Subject: mod_logio: introduce new optional function ap_logio_get_last_bytes to get total byte count of last request. core: Use ap_logio_get_last_bytes to report more accurate byte counts in mod_status if mod_logio is loaded. Without mod_logio, don't increment counts for HEAD requests. PR: 25656 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@823337 13f79535-47bb-0310-9956-ffa450edef68 --- modules/loggers/mod_logio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules/loggers') diff --git a/modules/loggers/mod_logio.c b/modules/loggers/mod_logio.c index fa8dc2178f..6de18a20b4 100644 --- a/modules/loggers/mod_logio.c +++ b/modules/loggers/mod_logio.c @@ -53,6 +53,7 @@ static const char logio_filter_name[] = "LOG_INPUT_OUTPUT"; typedef struct logio_config_t { apr_off_t bytes_in; apr_off_t bytes_out; + apr_off_t bytes_last_request; } logio_config_t; /* @@ -75,6 +76,18 @@ static void ap_logio_add_bytes_in(conn_rec *c, apr_off_t bytes){ cf->bytes_in += bytes; } +/* + * Optional function to get total byte count of last request for + * ap_increment_counts. + */ + +static apr_off_t ap_logio_get_last_bytes(conn_rec *c) +{ + logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module); + + return cf->bytes_last_request; +} + /* * Format items... */ @@ -104,6 +117,8 @@ static int logio_transaction(request_rec *r) logio_config_t *cf = ap_get_module_config(r->connection->conn_config, &logio_module); + /* need to save byte count of last request for ap_increment_counts */ + cf->bytes_last_request = cf->bytes_in + cf->bytes_out; cf->bytes_in = cf->bytes_out = 0; return OK; @@ -173,6 +188,7 @@ static void register_hooks(apr_pool_t *p) APR_REGISTER_OPTIONAL_FN(ap_logio_add_bytes_out); APR_REGISTER_OPTIONAL_FN(ap_logio_add_bytes_in); + APR_REGISTER_OPTIONAL_FN(ap_logio_get_last_bytes); } module AP_MODULE_DECLARE_DATA logio_module = -- cgit v1.2.1