X-Git-Url: http://www.privoxy.org/gitweb/show-status?a=blobdiff_plain;f=tools%2Fprivoxy-log-parser.pl;h=c2c13fe939373a851e0140d20ba0a4f054259b17;hb=d5f56945bf4887f8a3c8b017254cc8af8e01c82d;hp=b511931b07ded5dbd8f2359b1f31c057bc2a3222;hpb=f0dfc47636316ae1c4ec49e74df8148b8d08aacd;p=privoxy.git diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index b511931b..c2c13fe9 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -23,7 +23,7 @@ # hash key as input. # - Add --compress and --decompress options. # -# Copyright (c) 2007-2022 Fabian Keil +# Copyright (c) 2007-2023 Fabian Keil # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -1574,6 +1574,11 @@ sub handle_loglevel_connect($) { $c =~ s@(?<=accept failed: )(.*)@$h{'Error'}$1$h{'Standard'}@; + } elsif ($c =~ m/^Failed to accept\(\) incoming connection:/) { + + # Failed to accept() incoming connection: Software caused connection abort + $c =~ s@(?<=connection: )(.*)@$h{'Error'}$1$h{'Standard'}@; + } elsif ($c =~ m/^Overriding forwarding settings/) { # Overriding forwarding settings based on 'forward 10.0.0.1:8123' @@ -1805,8 +1810,13 @@ sub handle_loglevel_connect($) { } elsif ($c =~ m/^Optimistically sending /) { # Optimistically sending 318 bytes of client headers intended for www.privoxy.org + # Optimistically sending 318 bytes of client headers intended for www.privoxy.org. $c =~ s@(?<=sending )(\d+)@$h{'Number'}$1$h{'Standard'}@; - $c = highlight_matched_host($c, '(?<=for )[^\s]+'); + if ($c =~ /\.$/) { + $c = highlight_matched_host($c, '[^\s]+(?=\.)'); + } else { + $c = highlight_matched_host($c, '(?<=for )[^\s]+'); + } } elsif ($c =~ m/^Stopping to watch the client socket/) { @@ -2211,6 +2221,41 @@ sub handle_loglevel_error($) { return $c; } +sub handle_loglevel_received($) { + + my $c = shift; + + if ($c =~ m/^TLS from socket/) { + # TLS from socket 3: \x16\xda\xe2\xa2;\x0d\x0a + + $c =~ s@(?<=TLS from socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + + } elsif ($c =~ m/^from socket/) { + # from socket 3: HEAD http://p.p/ HTTP/1.1\x0d\x0aHost: p.p\x0d\x0aUser-Agent: curl/7.85.0\x0d\x0aAccept: */*\x0d\x0aProxy-Connection: Keep-Alive\x0d\x0a\x0d\x0a + + $c =~ s@(?<=from socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + } + + return $c; +} + +sub handle_loglevel_writing($) { + + my $c = shift; + + if ($c =~ m/^to socket/) { + # to socket 11: HTTP/1.1 200 Connection established\x0d\x0a\x0d\x0a + + $c =~ s@(?<=to socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + + } elsif ($c =~ m/^TLS on socket /) { + # TLS on socket 9: o~\xfcS[\xfa\x8f\xd6\x96\xe6_\xc7$\x1b[...] + + $c =~ s@(?<=TLS on socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + } + + return $c; +} sub handle_loglevel_ignore($) { return shift; @@ -2669,8 +2714,8 @@ sub parse_loop() { 'Force' => \&handle_loglevel_force, 'Error' => \&handle_loglevel_error, 'Fatal error' => \&handle_loglevel_ignore, - 'Writing' => \&handle_loglevel_ignore, - 'Received' => \&handle_loglevel_ignore, + 'Writing' => \&handle_loglevel_writing, + 'Received' => \&handle_loglevel_received, 'Tagging' => \&handle_loglevel_tagging, 'Actions' => \&handle_loglevel_ignore, 'Unknown log level' => \&handle_loglevel_ignore,