diff options
author | Stefan Fritsch <sf@apache.org> | 2009-10-08 21:42:13 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2009-10-08 21:42:13 +0000 |
commit | 92023763f1e20e3e36151dafd4d81014e230907e (patch) | |
tree | d72fe5c5676b333060aa2c951e82200f4410ecf4 /modules/loggers | |
parent | 3c6bce62c6657a4f5f7ae8fbf5027a193a34bb19 (diff) | |
download | httpd-92023763f1e20e3e36151dafd4d81014e230907e.tar.gz |
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
Diffstat (limited to 'modules/loggers')
-rw-r--r-- | modules/loggers/mod_logio.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; /* @@ -76,6 +77,18 @@ static void ap_logio_add_bytes_in(conn_rec *c, apr_off_t 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 = |