From 14ae95b35343d79502b18e635e5b9cb8efd23f13 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 31 Dec 2009 11:56:02 +0000 Subject: [PATCH] In handle_loglevel_header(), deal with "scan:" messages more efficiently. --- tools/privoxy-log-parser.pl | 39 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index 98e3d012..4f022309 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -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: ([^\)]*)\)/) { -- 2.39.2