Truncate overlong clients or versions.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-31 01:06:15 +02:00
parent 462f28505d
commit ed3fb3cda0
2 changed files with 4 additions and 0 deletions

View file

@ -500,6 +500,9 @@ sub ClientStats {
# 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}]/;
# truncate overlong clients or versions
$_->{'agent'} = substr($_->{'agent'}, 0, 150) if length($_->{'agent'}) > 150;
$_->{'version'} = substr($_->{'version'}, 0, 50) if $_->{'version'} and length($_->{'version'}) > 50;
# special cases
# Mozilla
$_->{'agent'} = 'Mozilla' if $_->{'agent'} eq '•Mozilla';

View file

@ -10,6 +10,7 @@ NewsStats 0.4.0 (unreleased)
* Add ClientStats to postingstats.
* gatherstats: Don't die on parsing errors.
* DBClnts: set version length to to 50.
* gatherstats: Truncate overlong clients or versions.
NewsStats 0.3.0 (2025-05-18)
* Extract GroupStats (in gatherstats) to subroutine.