From: Fabian Keil Date: Sat, 30 May 2020 06:05:55 +0000 (+0200) Subject: privoxy-log-parser.pl: Only show HTTP version distribution if at least one version... X-Git-Tag: v_3_0_29~339 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=eb8665a8fc511746b0a6dcbcd86a42f171204d3d privoxy-log-parser.pl: Only show HTTP version distribution if at least one version has been detected --- diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index 11ad7a88..c778b492 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -2250,9 +2250,13 @@ sub print_stats() { } else { print "Method distribution unknown. No CLF message parsed yet. Is 'debug 512' enabled?\n"; } - print "Client HTTP versions:\n"; - foreach my $http_version (sort {$stats{'http-version'}{$b} <=> $stats{'http-version'}{$a}} keys %{$stats{'http-version'}}) { - printf "%8d : %-8s\n", $stats{'http-version'}{$http_version}, $http_version; + if (exists $stats{'http-version'}) { + print "Client HTTP versions:\n"; + foreach my $http_version (sort {$stats{'http-version'}{$b} <=> $stats{'http-version'}{$a}} keys %{$stats{'http-version'}}) { + printf "%8d : %-8s\n", $stats{'http-version'}{$http_version}, $http_version; + } + } else { + print "HTTP version distribution unknown. No CLF message parsed yet. Is 'debug 512' enabled?\n"; } if (exists $stats{'status-code'}) { print "HTTP status codes:\n";