mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 07:19:24 +00:00
HttpUtils.pm: revert last changes, problems with Huebridge (Forum #120543)
git-svn-id: https://svn.fhem.de/fhem/trunk@24288 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
eac04fb94d
commit
e8d7397fbf
@ -81,19 +81,17 @@ HttpUtils_Close($)
|
||||
stacktrace();
|
||||
}
|
||||
}
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{conn});
|
||||
delete($hash->{compress}); # this is a potention user parameter
|
||||
}
|
||||
|
||||
# Stuff we can delete before we return control from HttpUtils
|
||||
sub
|
||||
HttpUtils_Cleanup($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
map { delete($hash->{$_}) if($_ =~ m/^hu_/) } sort keys %{$hash};
|
||||
delete($hash->{hu_inProgress});
|
||||
delete($hash->{hu_sslAdded});
|
||||
delete($hash->{hu_filecount});
|
||||
delete($hash->{hu_blocking});
|
||||
delete($hash->{hu_portSfx});
|
||||
delete($hash->{hu_proxy});
|
||||
delete($hash->{hu_port});
|
||||
delete($hash->{directReadFn});
|
||||
delete($hash->{directWriteFn});
|
||||
delete($hash->{compress});
|
||||
}
|
||||
|
||||
sub
|
||||
@ -414,7 +412,7 @@ HttpUtils_Connect($)
|
||||
IO::Socket::INET6->new(Proto=>'tcp', Blocking=>0);
|
||||
if(!$hash->{conn}) {
|
||||
Log3 $hash, $hash->{loglevel}, "HttpUtils: Creating socket: $!";
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
return $hash->{callback}($hash, "Creating socket: $!", "");
|
||||
}
|
||||
my $sa = length($iaddr)==4 ? sockaddr_in($port, $iaddr) :
|
||||
@ -451,7 +449,7 @@ HttpUtils_Connect($)
|
||||
my $err = HttpUtils_Connect2($hash);
|
||||
if($err) {
|
||||
Log3 $hash, $hash->{loglevel}, "HttpUtils: $err";
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
$hash->{callback}($hash, $err, "");
|
||||
}
|
||||
return $err;
|
||||
@ -558,7 +556,7 @@ HttpUtils_Connect2($)
|
||||
}
|
||||
|
||||
if($hash->{noConn2}) {
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
$hash->{callback}($hash);
|
||||
return undef;
|
||||
}
|
||||
@ -643,7 +641,7 @@ HttpUtils_Connect2($)
|
||||
RemoveInternalTimer(\%timerHash);
|
||||
my ($err, $ret, $redirect) = HttpUtils_ParseAnswer($hash);
|
||||
if(!$redirect) {
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
$hash->{callback}($hash, $err, $ret);
|
||||
}
|
||||
|
||||
@ -802,8 +800,6 @@ HttpUtils_ParseAnswer($)
|
||||
if(!$hash->{keepalive}) {
|
||||
$hash->{conn}->close();
|
||||
undef $hash->{conn};
|
||||
delete($hash->{FD});
|
||||
delete($selectlist{$hash});
|
||||
}
|
||||
|
||||
if(!$hash->{buf} && !$hash->{httpheader}) {
|
||||
@ -866,7 +862,7 @@ HttpUtils_ParseAnswer($)
|
||||
|
||||
# Request the URL with the Digest response
|
||||
if($hash->{callback}) {
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
HttpUtils_NonblockingGet($hash);
|
||||
return ("", "", 1);
|
||||
} else {
|
||||
@ -891,7 +887,7 @@ HttpUtils_ParseAnswer($)
|
||||
Log3 $hash, $hash->{loglevel}, "HttpUtils $hash->{displayurl}: ".
|
||||
"Redirect to ".($hash->{hideurl} ? "<hidden>" : $hash->{url});
|
||||
if($hash->{callback}) {
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
HttpUtils_NonblockingGet($hash);
|
||||
return ("", "", 1);
|
||||
} else {
|
||||
@ -950,7 +946,7 @@ HttpUtils_NonblockingGet($)
|
||||
|
||||
my $err = HttpUtils_Connect($hash);
|
||||
if($err) {
|
||||
HttpUtils_Cleanup($hash);
|
||||
delete($hash->{hu_inProgress});
|
||||
$hash->{callback}($hash, $err, "");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user