mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
final fix for "Network error" when stream files to client
It is important to FIRST disable zlib.output_compression (before headers are sent!) and THEN end all output-buffering! Without the two steps in this order, we are either limited by the memory limit or get the "Network error", because the streaming/fpassthrough does not apply the compression.
This commit is contained in:
parent
3eaed09185
commit
7e70eee888
@ -1504,6 +1504,11 @@ class Vfs extends Vfs\Base
|
||||
|
||||
//error_log("Total files: " . $total_files . " Peak memory to zip: " . self::hsize(memory_get_peak_usage(true)));
|
||||
|
||||
// FIRST: switch off zlib.output_compression, as this would limit downloads in size to memory_limit
|
||||
ini_set('zlib.output_compression',0);
|
||||
// SECOND: end all active output buffering
|
||||
while(ob_end_clean()) {}
|
||||
|
||||
// Stream the file to the client
|
||||
header("Content-Type: application/zip");
|
||||
header("Content-Length: " . filesize($zip_file));
|
||||
|
@ -446,6 +446,11 @@ class importexport_export_ui {
|
||||
$appname = $_GET['_appname'];
|
||||
$nicefname = $_GET['filename'] ? $_GET['filename'] : 'egw_export_'.$appname.'-'.date('Y-m-d');
|
||||
|
||||
// FIRST: switch off zlib.output_compression, as this would limit downloads in size to memory_limit
|
||||
ini_set('zlib.output_compression',0);
|
||||
// SECOND: end all active output buffering
|
||||
while(ob_end_clean()) {}
|
||||
|
||||
// Get charset
|
||||
$charset = Api\Cache::getSession('importexport', $tmpfname);
|
||||
|
||||
|
@ -42,8 +42,12 @@ if (!empty($_POST['download']))
|
||||
{
|
||||
$file = key($_POST['download']);
|
||||
$file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir
|
||||
while (@ob_end_clean()) {} // end all active output buffering
|
||||
ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit
|
||||
|
||||
// FIRST: switch off zlib.output_compression, as this would limit downloads in size to memory_limit
|
||||
ini_set('zlib.output_compression',0);
|
||||
// SECOND: end all active output buffering
|
||||
while(ob_end_clean()) {}
|
||||
|
||||
Api\Header\Content::type(basename($file));
|
||||
readfile($file);
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user