current/tools privoxy-log-parser.pl,1.163,1.164

Fabian Keil <[email protected]> Mon, 20 Feb 2017 15:57:42 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current/tools
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24863/tools

Modified Files:
	privoxy-log-parser.pl 
Log Message:
privoxy-log-parser: Fix an 'uninitialized value' warning

... when generating statistics for a log file without response headers.

While privoxy-log-parser was supposed to detect this already,
the check was flawed and the message the user didn't see was
somewhat confusing anyway.

Now the message is less confusing, more helpful and actually printed.

Reported by: Robert Klemme


Index: privoxy-log-parser.pl
===================================================================
RCS file: /cvsroot/ijbswa/current/tools/privoxy-log-parser.pl,v
retrieving revision 1.163
retrieving revision 1.164
diff -C2 -d -r1.163 -r1.164
*** privoxy-log-parser.pl	26 Aug 2016 11:19:53 -0000	1.163
--- privoxy-log-parser.pl	20 Feb 2017 15:57:40 -0000	1.164
***************
*** 2192,2202 ****
      printf "Improperly accounted requests: ~%d\n", abs($stats{requests} - $client_requests_checksum);
  
!     if ($stats{method} eq 0) {
!         print "No response lines parsed yet yet.\n";
!         return;
!     }
!     print "Method distribution:\n";
!     foreach my $method (sort {$stats{'method'}{$b} <=> $stats{'method'}{$a}} keys %{$stats{'method'}}) {
!         printf "%8d : %-8s\n", $stats{'method'}{$method}, $method;
      }
      print "Client HTTP versions:\n";
--- 2192,2202 ----
      printf "Improperly accounted requests: ~%d\n", abs($stats{requests} - $client_requests_checksum);
  
!     if (exists $stats{method}) {
!         print "Method distribution:\n";
!         foreach my $method (sort {$stats{'method'}{$b} <=> $stats{'method'}{$a}} keys %{$stats{'method'}}) {
!             printf "%8d : %-8s\n", $stats{'method'}{$method}, $method;
!         }
!     } else {
!         print "Method distribution unknown. No response headers parsed yet. Is 'debug 8' enabled?\n";
      }
      print "Client HTTP versions:\n";


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot