HttpUtils.pm: inflate patch from Markus (Forum #81186)

git-svn-id: https://svn.fhem.de/fhem/trunk@15631 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-12-17 12:33:03 +00:00
parent 3e8d7dc25d
commit 05b1f22ef8

View File

@ -813,11 +813,20 @@ HttpUtils_ParseAnswer($)
} }
} }
if($hash->{httpheader} =~ /^Content-Encoding: gzip/mi && $HU_use_zlib) { if($HU_use_zlib) {
if($hash->{httpheader} =~ /^Content-Encoding: gzip/mi) {
eval { $ret = Compress::Zlib::memGunzip($ret) }; eval { $ret = Compress::Zlib::memGunzip($ret) };
return ($@, $ret) if($@); return ($@, $ret) if($@);
} }
if($hash->{httpheader} =~ /^Content-Encoding: deflate/mi) {
eval { my $i = Compress::Zlib::inflateInit();
my $out = $i->inflate($ret);
$ret = $out if($out) };
return ($@, $ret) if($@);
}
}
# Debug # Debug
Log3 $hash, $hash->{loglevel}+1, Log3 $hash, $hash->{loglevel}+1,
"HttpUtils $hash->{displayurl}: Got data, length: ". length($ret); "HttpUtils $hash->{displayurl}: Got data, length: ". length($ret);