View | Details | Raw Unified | Return to bug 42699
Collapse All | Expand All

(-)server/core_filters.c (-4 / +9 lines)
Lines 343-348 Link Here
343
 */
343
 */
344
extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *logio_add_bytes_out;
344
extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *logio_add_bytes_out;
345
345
346
AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,add_bytes_out,(conn_rec *c, apr_off_t bytes), c, bytes, OK, DECLINES);
347
346
apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *new_bb)
348
apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *new_bb)
347
{
349
{
348
    conn_rec *c = f->c;
350
    conn_rec *c = f->c;
Lines 721-729 Link Here
721
            break;
723
            break;
722
        }
724
        }
723
    }
725
    }
724
    if ((logio_add_bytes_out != NULL) && (bytes_written > 0)) {
726
    if (bytes_written > 0) {
725
        logio_add_bytes_out(c, bytes_written);
727
    	if (logio_add_bytes_out != NULL) logio_add_bytes_out(c, bytes_written);
728
    	ap_run_add_bytes_out(c, bytes_written);
726
    }
729
    }
730
    
727
    *cumulative_bytes_written += bytes_written;
731
    *cumulative_bytes_written += bytes_written;
728
732
729
    arv = apr_socket_timeout_set(s, old_timeout);
733
    arv = apr_socket_timeout_set(s, old_timeout);
Lines 783-790 Link Here
783
            rv = arv;
787
            rv = arv;
784
        }
788
        }
785
    }
789
    }
786
    if ((logio_add_bytes_out != NULL) && (bytes_written > 0)) {
790
    if (bytes_written > 0) {
787
        logio_add_bytes_out(c, bytes_written);
791
    	if (logio_add_bytes_out != NULL) logio_add_bytes_out(c, bytes_written);
792
    	ap_run_add_bytes_out(c, bytes_written);
788
    }
793
    }
789
    *cumulative_bytes_written += bytes_written;
794
    *cumulative_bytes_written += bytes_written;
790
    if ((bytes_written < file_length) && (bytes_written > 0)) {
795
    if ((bytes_written < file_length) && (bytes_written > 0)) {
(-)include/http_core.h (+12 lines)
Lines 658-663 Link Here
658
APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
658
APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
659
                        (conn_rec *c, apr_off_t bytes));
659
                        (conn_rec *c, apr_off_t bytes));
660
660
661
/**
662
 * This hook provides a way for modules to track how many bytes of data is
663
 * ACTUALLY sent out verses the total size of the generated/static content
664
 * 
665
 * @param c A Connection Record handle
666
 * @param bytes the number of bytes sent out
667
 * 
668
 * @ingroup hooks
669
 */
670
AP_DECLARE_HOOK(int, add_bytes_out,
671
				(conn_rec *c, apr_off_t bytes))
672
661
/* ----------------------------------------------------------------------
673
/* ----------------------------------------------------------------------
662
 *
674
 *
663
 * ident lookups with mod_ident
675
 * ident lookups with mod_ident
(-)modules/loggers/mod_logio.c (-2 / +3 lines)
Lines 59-68 Link Here
59
 * Optional function for the core to add to bytes_out
59
 * Optional function for the core to add to bytes_out
60
 */
60
 */
61
61
62
static void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes){
62
static void logio_add_bytes_out(conn_rec *c, apr_off_t bytes){
63
    logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module);
63
    logio_config_t *cf = ap_get_module_config(c->conn_config, &logio_module);
64
64
65
    cf->bytes_out += bytes;
65
    cf->bytes_out += bytes;
66
    return OK;
66
}
67
}
67
68
68
/*
69
/*
Lines 161-167 Link Here
161
    ap_register_input_filter(logio_filter_name, logio_in_filter, NULL,
162
    ap_register_input_filter(logio_filter_name, logio_in_filter, NULL,
162
                             AP_FTYPE_NETWORK - 1);
163
                             AP_FTYPE_NETWORK - 1);
163
164
164
    APR_REGISTER_OPTIONAL_FN(ap_logio_add_bytes_out);
165
    AP_OPTIONAL_HOOK(add_bytes_out, logio_add_bytes_out, NULL, NULL, APR_HOOK_MIDDLE));
165
}
166
}
166
167
167
module AP_MODULE_D
168
module AP_MODULE_D

Return to bug 42699