From 084fa6d9d5a8f334765b42cf32d2142a38ff2214 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 17 Mar 2010 07:18:57 +0000 Subject: [PATCH] Relocated the require "Zlib". git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@596 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- webfrontend/pgm2/01_FHEMWEB.pm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/webfrontend/pgm2/01_FHEMWEB.pm b/webfrontend/pgm2/01_FHEMWEB.pm index 9a35838ab..60bb95492 100755 --- a/webfrontend/pgm2/01_FHEMWEB.pm +++ b/webfrontend/pgm2/01_FHEMWEB.pm @@ -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,