Handled things other than GET; fixed error output.

This commit is contained in:
Bradley M. Kuhn 2011-09-13 12:05:54 -04:00
parent 6d7d8af918
commit d9eff44e9b

6
oggcast-count.plx Normal file → Executable file
View file

@ -22,9 +22,9 @@ my %data;
while (<>) {
chomp;
die "invalid line: $!" unless
/^(\S+)\s+[^"]+"GET\s+(\S+)[\s"]/;
my($ip, $url) = ($1, $2);
die "invalid line: $_" unless /^(\S+)\s+[^"]+"\s*(HEAD|GET|POST)\s+(\S+)[\s"]/;
my($ip, $method, $url) = ($1, $2, $3);
next unless $method =~ /^\s*GET\s*$/i;
$data{$url}{$ip} = 0 unless defined $data{$url}{$ip};
$data{$url}{__TOTAL__} = 0 unless defined $data{$url}{__TOTAL__};