From 0e33fac4b16215d2ffc9145870ae34b84a9a4331 Mon Sep 17 00:00:00 2001 From: andi Date: Fri, 22 Apr 2005 22:08:17 +0200 Subject: size and timelimit for io_download darcs-hash:20050422200817-9977f-ccce2966eaa4258cf7a3ea29f9728108e501ab33.gz --- inc/io.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'inc/io.php') diff --git a/inc/io.php b/inc/io.php index 85cba7421..6c31cffc7 100644 --- a/inc/io.php +++ b/inc/io.php @@ -210,7 +210,14 @@ function io_download($url,$file){ $fp = @fopen($url,"rb"); if(!$fp) return false; + $kb = 0; + $now = time(); + while(!feof($fp)){ + if($kb++ > 2048 || (time() - $now) > 45){ + //abort on 2 MB and timeout on 45 sec + return false; + } $cont.= fread($fp,1024); } fclose($fp); -- cgit v1.2.3