From 8b45eeed8bb3277151096e989394f226784a214b Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 22 Sep 2008 05:35:36 +0000 Subject: [PATCH] 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 --- cake/libs/view/media.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cake/libs/view/media.php b/cake/libs/view/media.php index 25960ed95..f92199009 100644 --- a/cake/libs/view/media.php +++ b/cake/libs/view/media.php @@ -80,7 +80,6 @@ class MediaView extends View { 'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh', 'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml', 'mime' => 'www/mime', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-pdb'); - /** * Constructor * @@ -89,7 +88,6 @@ class MediaView extends View { function __construct(&$controller) { parent::__construct($controller); } - /** * Enter description here... * @@ -179,7 +177,7 @@ class MediaView extends View { } @ob_end_clean(); - while (!feof($handle) && connection_status() == 0) { + while (!feof($handle) && connection_status() == 0 && !connection_aborted()) { set_time_limit(0); $buffer = fread($handle, $chunkSize); echo $buffer; @@ -187,9 +185,7 @@ class MediaView extends View { @ob_flush(); } fclose($handle); - if (connection_status() == 0 && !connection_aborted()) { - return; - } + exit(0); } return false; }