[PHP] Sending a file with fpassthru() or readfile(), causes IE to hang.

2002-03-02 Thread John Chronakis

Hello,

I have posted the following message to php-windows but i got no answer.

I am using IIs 5 on windows 2k sp2 with php 4.1.1.
There is a problem with the sctipt that follows and MSIE versions 5 to 6.

A script sends a jpeg image to the client. It goes like this:

--
$imgsrc = 'full path of the image file';

header ("Content-type: some/image");
header ("Content-disposition: attachment; filename=myimage.jpg");
header ("Content-length: ".filesize($imgsrc) );

$fp = fopen( $imgsrc, "rb" );
if (!$fp) {
. Log the error .
exit;
}

fpassthru ($fp);

exit;
--

It works fine if the user desides to save or open the image.
But if the user cancels the download, Internet Explorer stops
receiving anything from the site. Any click on a link hangs
(IE displays in the status bar "Web site found. Waiting for reply")
Links to static html files on my web server work
and you can also browse any other sites, but nothing on my site that is
parsed by php works.

After some attemts (clicks and reloads), IIs reports the following message:
"HTTP 403.9 - Access Forbidden: Too many users are connected
Internet Information Services"
Increasing the user limit on IIS, just requires a few more atemts to show
this message.
After I close all IE instances or restart IIS, everything works fine again.

I have tried ignore_user_abort(1), sending expire headers, readfile()
instead of
fpassthru() etc but the problem persists.
Nothing changes with older versions of php or IE.

This problem does not happen when using Netscape (any version)
or download managers.
Similar script written in perl does not have the same problem.

Please help. It is a very-very late to switch to another scripting language
for this project (even using perl or asp for the download part requires a
great
deal of work).

John Chronakis




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Sending a file with fpassthru() or readfile(), causes IE to hang.

2002-03-03 Thread John Chronakis

After your reply I did some more tests with the following conclusions.

1. I was wrong about perl. IE behaves the same with the perl equivalent
script,
but requires the user to cancel 2 times. After the second time, you cannot
try anymore.

2. The source of the problem seems to be Internet Explorer and not the
server nor the
scripting language.
I have tested the same script under win2k with both IIs and apache
and both perl and php with the same results.
I have also tested both php and perl scripts on a linux running apache
1.3.14. Still the same problem.
After two attempts to download, then hit ok and at the "save as" dialog, hit
cancel, IE becomes useles.

I haven't tried asp, but something tells me it will make no difference.

Thanks.


John Chronakis


"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED].;
> I don't see how this can be a PHP problem.  If you say that a similar
> script written in Perl doesn't cause this, then simply compare the output
> of the Perl one to the PHP one and make sure they are sending the same
> thing.  If your IE browser gets confused with the PHP version then it must
> be sending something different from the Perl version.  There is no way for
> IE to tell that the image came from PHP and not something else.
>
> -Rasmus
>
> On Sat, 2 Mar 2002, John Chronakis wrote:
>
> > Hello,
> >
> > I have posted the following message to php-windows but i got no answer.
> >
> > I am using IIs 5 on windows 2k sp2 with php 4.1.1.
> > There is a problem with the sctipt that follows and MSIE versions 5 to
6.
> >
> > A script sends a jpeg image to the client. It goes like this:
> >
> > --
> > $imgsrc = 'full path of the image file';
> > 
> > header ("Content-type: some/image");
> > header ("Content-disposition: attachment; filename=myimage.jpg");
> > header ("Content-length: ".filesize($imgsrc) );
> >
> > $fp = fopen( $imgsrc, "rb" );
> > if (!$fp) {
> > . Log the error .
> > exit;
> > }
> >
> > fpassthru ($fp);
> >
> > exit;
> > --
> >
> > It works fine if the user desides to save or open the image.
> > But if the user cancels the download, Internet Explorer stops
> > receiving anything from the site. Any click on a link hangs
> > (IE displays in the status bar "Web site found. Waiting for reply")
> > Links to static html files on my web server work
> > and you can also browse any other sites, but nothing on my site that is
> > parsed by php works.
> >
> > After some attemts (clicks and reloads), IIs reports the following
message:
> > "HTTP 403.9 - Access Forbidden: Too many users are connected
> > Internet Information Services"
> > Increasing the user limit on IIS, just requires a few more atemts to
show
> > this message.
> > After I close all IE instances or restart IIS, everything works fine
again.
> >
> > I have tried ignore_user_abort(1), sending expire headers, readfile()
> > instead of
> > fpassthru() etc but the problem persists.
> > Nothing changes with older versions of php or IE.
> >
> > This problem does not happen when using Netscape (any version)
> > or download managers.
> > Similar script written in perl does not have the same problem.
> >
> > Please help. It is a very-very late to switch to another scripting
language
> > for this project (even using perl or asp for the download part requires
a
> > great
> > deal of work).
> >
> > John Chronakis
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Sending a file with fpassthru() or readfile(), causes IE to hang.

2002-03-03 Thread John Chronakis

And the answer came from Mircrosoft which describes this situation as a bug
in the article

Q266305 - BUG: Canceling Multiple File Downloads on Large File Causes
Internet Explorer to Stop Responding.

John Chronakis





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php