1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +00:00

HttpUtils.pm: Report error earlier (Forum #27565)

git-svn-id: https://svn.fhem.de/fhem/trunk@6686 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-10-05 09:57:35 +00:00
parent c4002b1cd1
commit ddaad27799

View File

@ -149,6 +149,8 @@ HttpUtils_Connect($)
} else { } else {
$hash->{conn} = IO::Socket::INET->new( $hash->{conn} = IO::Socket::INET->new(
PeerAddr=>"$host:$port", Timeout=>$hash->{timeout}); PeerAddr=>"$host:$port", Timeout=>$hash->{timeout});
return "$hash->{displayurl}: Can't connect(1) to $hash->{addr}: $@"
if(!$hash->{conn});
} }
return HttpUtils_Connect2($hash); return HttpUtils_Connect2($hash);
} }
@ -172,8 +174,8 @@ HttpUtils_Connect2($)
if(!$hash->{conn}) { if(!$hash->{conn}) {
undef $hash->{conn}; undef $hash->{conn};
my $err = $@; my $err = $@;
$err = "$SSL_ERR" if(!$err && $hash->{protocol} eq "https"); $err = $SSL_ERR if(!$err && $hash->{protocol} eq "https");
return "$hash->{displayurl}: Can't connect to $hash->{addr}: $err"; return "$hash->{displayurl}: Can't connect(2) to $hash->{addr}: $err";
} }
my $data; my $data;