From f7485561ddf849ac9e80d72809abf153e583694a Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 11 May 2025 10:54:16 +0200 Subject: [PATCH] Fix Path: header parsing. Signed-off-by: Thomas Hochstein --- bin/gatherstats.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/gatherstats.pl b/bin/gatherstats.pl index bb58252..e47f51f 100755 --- a/bin/gatherstats.pl +++ b/bin/gatherstats.pl @@ -301,16 +301,16 @@ sub HostStats { if (!$Host) { if ($Header{'path'} =~ /!([^!]+)!.POSTED!/) { $Host = "$1"; - } elsif ($Header{'path'} =~ /!.POSTED.([^!]+)!/) { + } elsif ($Header{'path'} =~ /([^!]+)!.POSTED.[^!]+!?/) { $Host = "$1"; } else { # iterate on the Path: header until we have a host name or no more # path elements while (!$Host && $Header{'path'} =~ /!/) { - ($Host) = $Header{'path'} =~ /!?([a-z0-9-_]+\.[a-z0-9-_.]+)![^!]+$/i; + ($Host) = $Header{'path'} =~ /!?([a-z0-9-_]+\.[a-z0-9-_.]+)!!?[^!]+!?$/i; undef($Host) if $Host && $Host =~ /\.MISMATCH/; # remove last path element - $Header{'path'} =~ s/![^!]+$//; + $Header{'path'} =~ s/!!?[^!]+$//; }; } }