Index: server/core_filters.c =================================================================== --- server/core_filters.c (revision 607631) +++ server/core_filters.c (working copy) @@ -343,6 +343,8 @@ */ extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *logio_add_bytes_out; +AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,add_bytes_out,(conn_rec *c, apr_off_t bytes), c, bytes, OK, DECLINES); + apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *new_bb) { conn_rec *c = f->c; @@ -721,9 +723,11 @@ break; } } - if ((logio_add_bytes_out != NULL) && (bytes_written > 0)) { - logio_add_bytes_out(c, bytes_written); + if (bytes_written > 0) { + if (logio_add_bytes_out != NULL) logio_add_bytes_out(c, bytes_written); + ap_run_add_bytes_out(c, bytes_written); } + *cumulative_bytes_written += bytes_written; arv = apr_socket_timeout_set(s, old_timeout); @@ -783,8 +787,9 @@ rv = arv; } } - if ((logio_add_bytes_out != NULL) && (bytes_written > 0)) { - logio_add_bytes_out(c, bytes_written); + if (bytes_written > 0) { + if (logio_add_bytes_out != NULL) logio_add_bytes_out(c, bytes_written); + ap_run_add_bytes_out(c, bytes_written); } *cumulative_bytes_written += bytes_written; if ((bytes_written < file_length) && (bytes_written > 0)) { Index: include/http_core.h =================================================================== --- include/http_core.h (revision 607631) +++ include/http_core.h (working copy) @@ -658,6 +658,18 @@ APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out, (conn_rec *c, apr_off_t bytes)); +/** + * This hook provides a way for modules to track how many bytes of data is + * ACTUALLY sent out verses the total size of the generated/static content + * + * @param c A Connection Record handle + * @param bytes the number of bytes sent out + * + * @ingroup hooks + */ +AP_DECLARE_HOOK(int, add_bytes_out, + (conn_rec *c, apr_off_t bytes)) + /* ---------------------------------------------------------------------- * * ident lookups with mod_ident Index: modules/loggers/mod_logio.c =================================================================== --- modules/loggers/mod_logio.c (revision 607631) +++ modules/loggers/mod_logio.c (working copy) @@ -59,10 +59,11 @@ * Optional function for the core to add to bytes_out */ -static void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes){ +static void logio_add_bytes_out(conn_rec *c, apr_off_t bytes){ logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module); cf->bytes_out += bytes; + return OK; } /* @@ -161,7 +162,7 @@ ap_register_input_filter(logio_filter_name, logio_in_filter, NULL, AP_FTYPE_NETWORK - 1); - APR_REGISTER_OPTIONAL_FN(ap_logio_add_bytes_out); + AP_OPTIONAL_HOOK(add_bytes_out, logio_add_bytes_out, NULL, NULL, APR_HOOK_MIDDLE)); } module AP_MODULE_D