#
# http://www.fabiankeil.de/sourcecode/privoxy-log-parser/
#
-# $Id: privoxy-log-parser.pl,v 1.155 2009/07/11 14:44:44 fk Exp $
+# $Id: privoxy-log-parser.pl,v 1.42 2009/07/21 14:04:25 fabiankeil Exp $
#
# TODO:
# - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting
or $c =~ m/Keeping the (?:server|client) header /
or $c =~ m/Content modified with no Content-Length header set/
or $c =~ m/^Appended client IP address to/
+ or $c =~ m/^Removing 'Connection: close' to imply keep-alive./
)
{
# XXX: Some of these may need highlighting
# Keeping the client header 'Connection: keep-alive' around. The connection will be kept alive if possible.
# Content modified with no Content-Length header set. Creating a fake one for adjustment later on.
# Appended client IP address to X-Forwarded-For: 10.0.0.2, 10.0.0.1
+ # Removing 'Connection: close' to imply keep-alive.
} elsif ($c =~ m/^scanning headers for:/) {
$c =~ s@(?<=failed: )(.*)@$h{'error'}$1$h{'Standard'}@;
- } elsif ($c =~ m/^to ([^\s]*) successful$/) {
+ } elsif ($c =~ m/^to ([^\s]*)( successful)?$/) {
# Connect: to www.nzherald.co.nz successful
+ # Connect: to archiv.radiotux.de
return '' if SUPPRESS_SUCCESSFUL_CONNECTIONS;
$c = highlight_matched_host($c, '(?<=to )[^\s]+');
$c =~ m/^Complete client request received/ or
$c =~ m/^Possible pipeline attempt detected./ or
$c =~ m/^POST request detected. The connection will not be kept alive./ or
- $c =~ m/^The server still wants to talk, but the client hung up on us./) {
+ $c =~ m/^The server still wants to talk, but the client hung up on us./ or
+ $c =~ m/^The server didn't specify how long the connection will stay open/ or
+ $c =~ m/^There might be a request body. The connection will not be kept alive/) {
# Looks like we reached the end of the last chunk. We better stop reading.
# Looks like we read the end of the last chunk together with the server \
# kept alive and we will only serve the first request.
# POST request detected. The connection will not be kept alive.
# The server still wants to talk, but the client hung up on us.
+ # The server didn't specify how long the connection will stay open. Assume it's only a second.
+ # There might be a request body. The connection will not be kept alive.
} else {
$output = '';
- if (m/^(\w{3} \d{2}) (\d\d:\d\d:\d\d)\.?(\d+)? (?:Privoxy\()?([^\)\s]*)[\)]? ([\w -]*): (.*)$/) {
+ if (m/^(\w{3} \d{2}) (\d\d:\d\d:\d\d)\.?(\d+)? (?:Privoxy\()?([^\)\s]*)[\)]? ([\w -]*): (.*?)\r?$/) {
# XXX: Put in req hash?
$day = $1;
$time_stamp = $2;