From f3b184f2e315a5c9c89da09c3ff3434fffc639f4 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sat, 17 Jan 2026 03:01:54 +0100 Subject: [PATCH] gatherstats: Don't' overwrite User-Agent with X-Newsreader. Signed-off-by: Thomas Hochstein --- bin/gatherstats.pl | 6 +++--- doc/ChangeLog | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/gatherstats.pl b/bin/gatherstats.pl index 776b787..8ec32ec 100755 --- a/bin/gatherstats.pl +++ b/bin/gatherstats.pl @@ -411,8 +411,8 @@ sub ClientStats { # parse header # User-Agent style if ($Header{'x-newsreader'} =~ /^([^\/ ]+\/[^\/ ]+ ?)+$/) { - # transfer to user-agent and parse from there - $Header{'user-agent'} = $Header{'x-newsreader'}; + # transfer to user-agent, if not set, and parse from there + $Header{'user-agent'} = $Header{'x-newsreader'} if !$Header{'user-agent'}; # "client name version" } elsif ($Header{'x-newsreader'} =~ / /) { ($Client, $Version) = ParseXNewsreader($Header{'x-newsreader'}); @@ -428,7 +428,7 @@ sub ClientStats { version => $Version); push @Clients, { %UserAgent }; } else { - $Header{'user-agent'} = $Header{'x-newsreader'}; + $Header{'user-agent'} = $Header{'x-newsreader'} if !$Header{'user-agent'}; } } ### User-Agent diff --git a/doc/ChangeLog b/doc/ChangeLog index 8c3753f..754c69f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -6,6 +6,7 @@ NewsStats 0.5.0 (unreleased) * Rename postingstats.pl to poststats.pl, rename dopostingstats.sh accordingly, fix all references. * Fix missing variable initialisation in FormatOutput(). + * gatherstats: Don't' overwrite User-Agent with X-Newsreader. NewsStats 0.4.0 (2025-06-02) * Reformat $Conf{TLH} for GroupStats only.