HttpUtils.pm: fix dnsHostsFile search (Forum #119497)

git-svn-id: https://svn.fhem.de/fhem/trunk@23965 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2021-03-14 09:44:41 +00:00
parent 371c103c40
commit c086bc8d6c

View File

@@ -251,7 +251,8 @@ HttpUtils_gethostbyname($$$$)
my $fh;
if(open($fh, $dh)) {
while(my $line = <$fh>) {
if($line =~ m/^([^# \t]+).*\b\Q$host\E\b/) {
if($line =~ m/^([^#\s]+).*?\s\Q$host\E\s/ ||
$line =~ m/^([^#\s]+).*?\s\Q$host\E$/) {
if($1 =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ && # IP-Address
$1<256 && $2<256 && $3<256 && $4<256) {
$fn->($hash, undef, pack("CCCC", $1, $2, $3, $4));