Remove whitespace from client and version.
Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
parent
ed3fb3cda0
commit
0102b72971
|
@ -497,6 +497,9 @@ sub ClientStats {
|
||||||
foreach (@Clients) {
|
foreach (@Clients) {
|
||||||
# filter agents for User-Agent with multiple agents
|
# filter agents for User-Agent with multiple agents
|
||||||
next if $#Clients && exists($DropAgent{lc($_->{'agent'})});
|
next if $#Clients && exists($DropAgent{lc($_->{'agent'})});
|
||||||
|
# remove whitespace
|
||||||
|
$_->{'agent'} =~ s/^\s+|\s+$//g;
|
||||||
|
$_->{'version'} =~ s/^\s+|\s+$//g if $_->{'version'};
|
||||||
# encode to utf-8, if necessary
|
# encode to utf-8, if necessary
|
||||||
$_->{'agent'} = encode('UTF-8', $_->{'agent'}) if $_->{'agent'} =~ /[\x80-\x{ffff}]/;
|
$_->{'agent'} = encode('UTF-8', $_->{'agent'}) if $_->{'agent'} =~ /[\x80-\x{ffff}]/;
|
||||||
$_->{'version'} = encode('UTF-8', $_->{'version'}) if $_->{'version'} and $_->{'version'} =~ /[\x80-\x{ffff}]/;
|
$_->{'version'} = encode('UTF-8', $_->{'version'}) if $_->{'version'} and $_->{'version'} =~ /[\x80-\x{ffff}]/;
|
||||||
|
@ -664,8 +667,7 @@ sub RemoveComments {
|
||||||
# remove superfluous whitespace in header
|
# remove superfluous whitespace in header
|
||||||
# and whitespace around header
|
# and whitespace around header
|
||||||
$Header =~ s/\s+/ /g;
|
$Header =~ s/\s+/ /g;
|
||||||
$Header =~ s/^\s+//;
|
$Header =~ s/^\s+|\s+$//g;
|
||||||
$Header =~ s/\s+$//;
|
|
||||||
|
|
||||||
return $Header;
|
return $Header;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ NewsStats 0.4.0 (unreleased)
|
||||||
* gatherstats: Don't die on parsing errors.
|
* gatherstats: Don't die on parsing errors.
|
||||||
* DBClnts: set version length to to 50.
|
* DBClnts: set version length to to 50.
|
||||||
* gatherstats: Truncate overlong clients or versions.
|
* gatherstats: Truncate overlong clients or versions.
|
||||||
|
* gatherstats: Remove whitespace from client and version.
|
||||||
|
|
||||||
NewsStats 0.3.0 (2025-05-18)
|
NewsStats 0.3.0 (2025-05-18)
|
||||||
* Extract GroupStats (in gatherstats) to subroutine.
|
* Extract GroupStats (in gatherstats) to subroutine.
|
||||||
|
|
Loading…
Reference in a new issue