CC: | Wes Brown <wes [...] smellycat.com> |
Subject: | Greedy Regex in AnyData::Format::Weblog |
Date: | Wed, 9 Nov 2011 19:57:45 -0500 |
To: | bug-AnyData [...] rt.cpan.org |
From: | Wes Brown <wes [...] smellycat.com> |
There appears to be a "greedy regex" in the parse section of the
AnyData::Format::Weblog
AnyData-0.10
I can provide the "normally requested" 'perl -v' and system type ('uname -a') if
required. The patch below at least allows an Apache weblog to be run if
the following line is in the httpd.conf file, but client and referer are
not correct:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T \"JSESSION=%{JSESSIONID}C\"" combined
$ diff -u Weblog.pm-orig Weblog.pm
--- Weblog.pm-orig 2004-04-18 16:15:50.000000000 -0400
+++ Weblog.pm 2011-11-09 18:27:22.000000000 -0500
@@ -89,7 +89,7 @@
$str =~ s/\s+$//;
return undef unless $str;
my(@row) = $str =~
- /^(\S*) (\S*) (\S*) \[([^\]]*)\] "(.*)" (\S*) (\S*)\s*(.*)$/;
+ /^(\S*) (\S*) (\S*) \[([^\]]*)\] "([^\"]*)" (\S*) (\S*)\s*(.*)$/;
return undef unless defined $row[0];
my($client,$referer) = $row[7] =~ /^(.*) (\S*)$/;
$client ||= '';
Wes