@@ -18,15 +18,33 @@ module AP_MODULE_DECLARE_DATA log_header_size_module;
1818
1919typedef struct log_header_size_config_t {
2020 apr_off_t bytes_in_header ;
21+ apr_off_t bytes_out_header ;
2122} log_header_size_config_t ;
2223
24+ static int gather_header_size (void * b_ , const char * key , const char * value )
25+ {
26+ int * b = b_ ;
27+ (* b ) += strlen (key );
28+ (* b ) += strlen (value );
29+
30+ return 1 ;
31+ }
32+
2333static const char * log_bytes_in_header (request_rec * r , char * a )
2434{
2535 log_header_size_config_t * cf = ap_get_module_config (r -> connection -> conn_config , & log_header_size_module );
2636
2737 return apr_off_t_toa (r -> pool , cf -> bytes_in_header );
2838}
2939
40+ static const char * log_bytes_out_header (request_rec * r , char * a )
41+ {
42+ log_header_size_config_t * cf = ap_get_module_config (r -> connection -> conn_config , & log_header_size_module );
43+ apr_table_do (gather_header_size , & cf -> bytes_out_header , r -> headers_out , NULL );
44+
45+ return apr_off_t_toa (r -> pool , cf -> bytes_out_header );
46+ }
47+
3048static int log_header_size_pre_connection (conn_rec * c , void * csd )
3149{
3250 log_header_size_config_t * cf = apr_palloc (c -> pool , sizeof (* cf ));
@@ -44,20 +62,12 @@ static int log_header_size_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_
4462
4563 if (log_pfn_register ) {
4664 log_pfn_register (p , "^IH" , log_bytes_in_header , 0 );
65+ log_pfn_register (p , "^OH" , log_bytes_out_header , 0 );
4766 }
4867
4968 return OK ;
5069}
5170
52- static int gather_header_size (void * b_ , const char * key , const char * value )
53- {
54- int * b = b_ ;
55- (* b ) += strlen (key );
56- (* b ) += strlen (value );
57-
58- return 1 ;
59- }
60-
6171static int log_header_size_post_read_request (request_rec * r )
6272{
6373 log_header_size_config_t * cf = ap_get_module_config (r -> connection -> conn_config , & log_header_size_module );
@@ -69,7 +79,7 @@ static int log_header_size_post_read_request(request_rec *r)
6979static int log_header_size_log_transaction (request_rec * r )
7080{
7181 log_header_size_config_t * cf = ap_get_module_config (r -> connection -> conn_config , & log_header_size_module );
72- cf -> bytes_in_header = 0 ;
82+ cf -> bytes_in_header = cf -> bytes_out_header = 0 ;
7383
7484 return OK ;
7585}
0 commit comments