From 143bf438534e367132cb0728e1e807d265f9596b Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Tue, 20 Apr 2021 16:00:01 +0000 Subject: [PATCH] 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 --- fhem/FHEM/HttpUtils.pm | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/fhem/FHEM/HttpUtils.pm b/fhem/FHEM/HttpUtils.pm index 1442d5b3f..491a8ed6e 100644 --- a/fhem/FHEM/HttpUtils.pm +++ b/fhem/FHEM/HttpUtils.pm @@ -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} ? "" : $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, ""); } }