From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 29 May 2020 17:10:14 +0000 (+0200)
Subject: privoxy-log-parser.pl: Include the size of the content Privoxy transferred
X-Git-Tag: v_3_0_29~347
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/@default-cgi@edit-actions-add-url-form?a=commitdiff_plain;h=14527552acdee9ed2ccfccb95633d864fa720718;p=privoxy.git

privoxy-log-parser.pl: Include the size of the content Privoxy transferred

... excluding HTTP headers.
---

diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl
index f370e950..c24b89b4 100755
--- a/tools/privoxy-log-parser.pl
+++ b/tools/privoxy-log-parser.pl
@@ -2009,6 +2009,7 @@ sub gather_loglevel_clf_stats ($) {
         $resource =~ m@(?:http[s]://)([^/]+)/?@;
         $stats{'hosts'}{$1}++;
     }
+    $stats{'content-size-total'} += $size;
 }
 
 sub gather_loglevel_request_stats ($$) {
@@ -2137,6 +2138,7 @@ sub init_stats () {
         'reused-connections' => 0,
         'server-keep-alive' => 0,
         'closed-client-connections' => 0,
+        'content-size-total' => 0,
         );
         $stats{'client-requests-on-connection'}{1} = 0;
 }
@@ -2201,7 +2203,9 @@ sub print_stats () {
         get_percentage($stats{requests}, $stats{'empty-responses-on-reused-connections'}) .
         ")\n";
     print "Client connections: " .  $stats{'closed-client-connections'} . "\n";
-
+    if ($stats{'content-size-total'}) {
+        print "Bytes transfered excluding headers: " .  $stats{'content-size-total'} . "\n";
+    }
     my $lines_printed = 0;
     print "Client requests per connection distribution:\n";
     foreach my $client_requests (sort {