2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

Missing Zlib with multiple WEB instances crashes fhem

git-svn-id: https://svn.fhem.de/fhem/trunk@981 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2011-08-14 10:06:18 +00:00
parent e36dec11a4
commit 3e135400fa

View File

@ -41,6 +41,7 @@ use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW
use vars qw($FW_tp); # is touchpad (iPad / etc)
use vars qw(%FW_types);# device types, for sorting, for 97_GROUP/95_VIEW
my $zlib_loaded;
my $try_zlib = 1;
#########################
@ -208,10 +209,11 @@ FW_Read($)
my $ll = GetLogLevel($FW_wname,4);
my $c = $hash->{CD};
if(!$zlib_loaded && AttrVal($FW_wname, "fwcompress", 1)) {
if(!$zlib_loaded && $try_zlib && AttrVal($FW_wname, "fwcompress", 1)) {
$zlib_loaded = 1;
eval { require Compress::Zlib; };
if($@) {
$try_zlib = 0;
Log 1, $@;
Log 1, "$FW_wname: Can't load Compress::Zlib, deactivating compression";
$attr{$FW_wname}{fwcompress} = 0;
@ -280,8 +282,8 @@ FW_Read($)
$FW_RETTYPE=~m/svg/i ||
$FW_RETTYPE=~m/script/i) &&
(int(@enc) == 1 && $enc[0] =~ m/gzip/) &&
$try_zlib &&
AttrVal($FW_wname, "fwcompress", 1)) {
$FW_RET = Compress::Zlib::memGzip($FW_RET);
$compressed = "Content-Encoding: gzip\r\n";
}