[PHP] Re: Bug ? Script download problem if user abort download

2001-10-31 Thread Gianluca Morello

I retry using the following snuppet:

...
while (!connection_aborted()  !feof($fp) )
 {
  echo fread($fp, 1000);
  }

but nothing change.
I try also with connection_status() and ignore_user_abort(false) but nothign
change.
If the user abort the download progress, the php process hang.



Gianluca Morello [EMAIL PROTECTED] ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a download script on IIS 5 and Php 4.0.6 as cgi:

  $filename=PDF_PATH.$codfile..pdf;
   $fp=fopen($filename,rb);
   if ($fp)
   {
header(Content-type: application/octet-stream\n );
header(Content-transfer-encoding: binary\n);
header(Content-length:  . filesize($filename) . \n);
header(Content-disposition: attachment; filename=.$codfile..pdf\n);
$contents=;
while (!feof($fp))
{
 $contents .= fread($fp, 1000);
}
fclose($fp);
print($contents);


 the script works very well.
 But if the user press the Cancel button in the browser download dialog,
the
 current php process stop working. If i try to load a new page another php
 process is spawned, but do nothing.
 If i look in the task manager i see my php processes running (without
doing
 nothing).
 When the timeout occurs the php engine continue wotking correctly.

 If i close the browser while php is hang, and i start a new browser
session
 the php pages are correctly processed.


 I try several other methods :
 readfile,fpassthru,fread($fp,filesize),read and print a small chunks of
 data, but nothing change, when the user abort the download operation the
php
 hang.

 This behaviour is very similar to the following bug:
 http://bugs.php.net/?id=8215 , that appears to be closed





 --
 Gianluca Morello
 Editek S.r.l.
 http://www.editek.it
 Via Vitruvio, 43 - Milano
 Mail: [EMAIL PROTECTED]
 Tel. : 02-671166208
 Fax : 02-67493766





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Bug ? Script download problem if user abort download

2001-10-30 Thread Gianluca Morello

I have a download script on IIS 5 and Php 4.0.6 as cgi:

 $filename=PDF_PATH.$codfile..pdf;
  $fp=fopen($filename,rb);
  if ($fp)
  {
   header(Content-type: application/octet-stream\n );
   header(Content-transfer-encoding: binary\n);
   header(Content-length:  . filesize($filename) . \n);
   header(Content-disposition: attachment; filename=.$codfile..pdf\n);
   $contents=;
   while (!feof($fp))
   {
$contents .= fread($fp, 1000);
   }
   fclose($fp);
   print($contents);


the script works very well.
But if the user press the Cancel button in the browser download dialog, the
current php process stop working. If i try to load a new page another php
process is spawned, but do nothing.
If i look in the task manager i see my php processes running (without doing
nothing).
When the timeout occurs the php engine continue wotking correctly.

If i close the browser while php is hang, and i start a new browser session
the php pages are correctly processed.


I try several other methods :
readfile,fpassthru,fread($fp,filesize),read and print a small chunks of
data, but nothing change, when the user abort the download operation the php
hang.

This behaviour is very similar to the following bug:
http://bugs.php.net/?id=8215 , that appears to be closed





--
Gianluca Morello
Editek S.r.l.
http://www.editek.it
Via Vitruvio, 43 - Milano
Mail: [EMAIL PROTECTED]
Tel. : 02-671166208
Fax : 02-67493766



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]