Remove whitespace from client and version.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-31 00:48:23 +02:00
parent ed3fb3cda0
commit 0102b72971
2 changed files with 5 additions and 2 deletions

View file

@ -497,6 +497,9 @@ sub ClientStats {
foreach (@Clients) {
# filter agents for User-Agent with multiple agents
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
$_->{'agent'} = encode('UTF-8', $_->{'agent'}) if $_->{'agent'} =~ /[\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
# and whitespace around header
$Header =~ s/\s+/ /g;
$Header =~ s/^\s+//;
$Header =~ s/\s+$//;
$Header =~ s/^\s+|\s+$//g;
return $Header;
}