In handle_loglevel_header(), deal with "scan:" messages more efficiently.
authorFabian Keil <fk@fabiankeil.de>
Thu, 31 Dec 2009 11:56:02 +0000 (11:56 +0000)
committerFabian Keil <fk@fabiankeil.de>
Thu, 31 Dec 2009 11:56:02 +0000 (11:56 +0000)
tools/privoxy-log-parser.pl

index 98e3d01..4f02230 100755 (executable)
@@ -8,7 +8,7 @@
 #
 # http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
 #
-# $Id: privoxy-log-parser.pl,v 1.69 2009/12/31 11:54:55 fabiankeil Exp $
+# $Id: privoxy-log-parser.pl,v 1.70 2009/12/31 11:55:27 fabiankeil Exp $
 #
 # TODO:
 #       - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
@@ -784,25 +784,7 @@ sub handle_loglevel_header ($) {
 
     if ($c =~ /^scan:/) {
 
-        if ($c =~ m/^scan: ((\w+) (.+) (HTTP\/\d\.\d))/) {
-
-            # Client request line
-            # Save for statistics (XXX: Not implemented yet)
-            $req{$t}{'method'} = $2;
-            $req{$t}{'destination'} = $3;
-            $req{$t}{'http-version'} = $4;
-
-            $c = highlight_request_line($1);
-
-        } elsif ($c =~ m/^(scan: )((?:HTTP\/\d\.\d|ICY) (\d+) (.*))/) {
-
-            # Server response line
-            $req{$t}{'response_line'} = $2;
-            $req{$t}{'status_code'} = $3;
-            $req{$t}{'status_message'} = $4;
-            $c = $1 . highlight_response_line($req{$t}{'response_line'});
-
-        } elsif ($c =~ m/^scan: ((?>[^:]+)):/) {
+        if ($c =~ m/^scan: ([^: ]+):/) {
 
             # Register new headers
             # scan: Accept: image/png,image/*;q=0.8,*/*;q=0.5
@@ -819,6 +801,23 @@ sub handle_loglevel_header ($) {
                 update_header_highlight_regex($header);
             }
 
+        } elsif ($c =~ m/^scan: ((\w+) (.+) (HTTP\/\d\.\d))/) {
+
+            # Client request line
+            # Save for statistics (XXX: Not implemented yet)
+            $req{$t}{'method'} = $2;
+            $req{$t}{'destination'} = $3;
+            $req{$t}{'http-version'} = $4;
+
+            $c = highlight_request_line($1);
+
+        } elsif ($c =~ m/^(scan: )((?:HTTP\/\d\.\d|ICY) (\d+) (.*))/) {
+
+            # Server response line
+            $req{$t}{'response_line'} = $2;
+            $req{$t}{'status_code'} = $3;
+            $req{$t}{'status_message'} = $4;
+            $c = $1 . highlight_response_line($req{$t}{'response_line'});
         }
 
     } elsif ($c =~ m/^Crunching (?:server|client) header: .* \(contains: ([^\)]*)\)/) {