Fixing MediaView so it will stop reading file when connection is aborted.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7642 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-09-22 05:35:36 +00:00
parent fafb01b09d
commit 8b45eeed8b

View file

@ -80,7 +80,6 @@ class MediaView extends View {
'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh', 'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh',
'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml', 'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml',
'mime' => 'www/mime', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-pdb'); 'mime' => 'www/mime', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-pdb');
/** /**
* Constructor * Constructor
* *
@ -89,7 +88,6 @@ class MediaView extends View {
function __construct(&$controller) { function __construct(&$controller) {
parent::__construct($controller); parent::__construct($controller);
} }
/** /**
* Enter description here... * Enter description here...
* *
@ -179,7 +177,7 @@ class MediaView extends View {
} }
@ob_end_clean(); @ob_end_clean();
while (!feof($handle) && connection_status() == 0) { while (!feof($handle) && connection_status() == 0 && !connection_aborted()) {
set_time_limit(0); set_time_limit(0);
$buffer = fread($handle, $chunkSize); $buffer = fread($handle, $chunkSize);
echo $buffer; echo $buffer;
@ -187,9 +185,7 @@ class MediaView extends View {
@ob_flush(); @ob_flush();
} }
fclose($handle); fclose($handle);
if (connection_status() == 0 && !connection_aborted()) { exit(0);
return;
}
} }
return false; return false;
} }