2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-05 08:20:23 +00:00

Relocated the require "Zlib".

git-svn-id: https://svn.fhem.de/fhem/trunk@596 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2010-03-17 07:18:57 +00:00
parent aa1979fa18
commit 2904d2b534

View File

@ -171,9 +171,18 @@ FW_Read($)
}
$__wname = $hash->{SNAME};
my $ll = GetLogLevel($__wname,4);
if(!$zlib_loaded && FW_getAttr($__wname, "fwcompress", 1)) {
$zlib_loaded = 1;
eval { require Compress::Zlib; };
if($@) {
Log 1, $@;
Log 1, "$__wname: Can't load Compress::Zlib, deactivating compression";
$attr{$__wname}{fwcompress} = 0;
}
}
# Data from HTTP Client
my $buf;
my $ret = sysread($hash->{CD}, $buf, 1024);
@ -207,16 +216,6 @@ FW_Read($)
$defs{$name} = $hash;
}
if(!$zlib_loaded && FW_getAttr($__wname, "fwcompress", 1)) {
$zlib_loaded = 1;
eval { require Compress::Zlib; };
if($@) {
Log 1, $@;
Log 1, "$__wname: Can't load Compress::Zlib, deactivating compression";
$attr{$__wname}{fwcompress} = 0;
}
}
my $compressed = "";
if(($__RETTYPE=~m/text/i || $__RETTYPE=~m/svg/i || $__RETTYPE=~m/script/i) &&
(int(@enc) == 1 && $enc[0] =~ m/gzip/) &&
@ -230,7 +229,7 @@ FW_Read($)
my $length = length($__RET);
my $expires = ($cacheable?
("Expires: ".localtime(time()+900)." GMT\r\n") : "");
#Log 0, "$arg / RL: $length / $__RETTYPE / $compressed";
#Log 0, "$arg / RL: $length / $__RETTYPE / $compressed";
print $c "HTTP/1.1 200 OK\r\n",
"Content-Length: $length\r\n",
$expires, $compressed,