Fix Path: header parsing.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-11 10:54:16 +02:00
parent f6b7a1d000
commit f7485561dd

View file

@ -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/!!?[^!]+$//;
};
}
}