2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +00:00

01_FHEMWEB.pm: fix bogus internal data in websocket (Forum #125866)

git-svn-id: https://svn.fhem.de/fhem/trunk@25637 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-02-06 13:08:44 +00:00
parent c34bb3f6e7
commit 885d68d66b

View File

@ -617,7 +617,7 @@ FW_finishRead($$$)
$FW_httpheader{"Accept-Encoding"} =~ m/gzip/) &&
$FW_use{zlib}) {
utf8::encode($FW_RET)
if(utf8::is_utf8($FW_RET) && $FW_RET =~ m/[^\x00-\xFF]/ );
if(utf8::is_utf8($FW_RET) || $FW_RET =~ m/[^\x00-\xFF]/ );
eval { $FW_RET = Compress::Zlib::memGzip($FW_RET); };
if($@) {
Log 1, "memGzip: $@"; $FW_RET=""; #Forum #29939
@ -715,7 +715,7 @@ FW_addToWritebuffer($$@)
{
my ($hash, $txt, $callback, $nolimit) = @_;
utf8::encode($txt) if(utf8::is_utf8($txt) && $txt =~ m/[^\x00-\xFF]/ );
utf8::encode($txt) if(utf8::is_utf8($txt) || $txt =~ m/[^\x00-\xFF]/ );
if( $hash->{websocket} ) {
my $len = length($txt);
if( $len < 126 ) {