Bug ? Script download problem if user abort download
| From: | Gianluca Morello | Date: | Tue, 30 Oct 2001 17:36:47 +0000 |
| Subject: | Bug ? Script download problem if user abort download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72902@lists.php.net to get a copy of this message | ||
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: gianluca.morello@editek.it
Tel. : 02-671166208
Fax : 02-67493766