2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

01_FHEMWEB.pm: jump to the end for large text-logs (Forum #37042)

git-svn-id: https://svn.fhem.de/fhem/trunk@8556 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-05-10 07:47:07 +00:00
parent 31e19cc960
commit 0c424323a3

View File

@ -1556,6 +1556,7 @@ FW_returnFileAsStream($$$$$)
return 0;
}
binmode(FH) if($type !~ m/text/); # necessary for Windows
my $sz = -s $path;
$etag = defined($etag) ? "ETag: \"$etag\"\r\n" : "";
my $expires = $cacheable ? ("Expires: ".gmtime(time()+900)." GMT\r\n"): "";
@ -1569,6 +1570,9 @@ FW_returnFileAsStream($$$$$)
my $d = Compress::Zlib::deflateInit(-WindowBits=>31) if($compr);
FW_outputChunk($FW_chash, $FW_RET, $d);
FW_outputChunk($FW_chash,
"<a href='#end_of_file'>jump to the end</a><br><br>", $d)
if($doEsc && $sz > 2048);
my $buf;
while(sysread(FH, $buf, 2048)) {
if($doEsc) { # FileLog special
@ -1578,6 +1582,8 @@ FW_returnFileAsStream($$$$$)
FW_outputChunk($FW_chash, $buf, $d);
}
close(FH);
FW_outputChunk($FW_chash, "<a name='end_of_file'></a>", $d)
if($doEsc && $sz > 2048);
FW_outputChunk($FW_chash, $suffix, $d);
if($compr) {