Sorry, meant to send this to the list.
--
<snip>
>How would a script get aborted? Unless you abort a script running
>yourself, I believe mod_perl scripts will continue to run whether or
>not the client is still connected. You >might do something, like in
>Script_OnEnd like a test for $Response->IsClientConnected to find out
>if the client was still connected when the script ran to completion.
Interesting question. I guess I assumed that if the user clicks stop or
the connection gets dropped for whatever reason that the script stops
executing. My bad.
My app lets users choose and download files. I have a script that
actually sends the file to the user (using sysread and
$Response->BinaryWrite()).
So are you saying that if the user clicks the stop button on the
browser, that the script will continue to execute?
I would assume then that $Response->BinaryWrite() will fail. I don't see
any way to test the success of this call in the docs..
I was thinking something along the lines of:
My ($done,$rv,$buffer);
Sub cleanup {
my $dr=shift;
if ($$dr) {
app->dl_failed;
} else {
app->dl_succeeded;
}
}
$Server->Register_cleanup (&cleanup(\$done);
$done=0;
Open (I,"$dlfile") || something ..
While (($rv=sysread(I,$buffer,$bufsz))!=0) {
$Response->BinaryWrite($buffer);
}
$done=1;
--
I know that there is a race condition here. Havn't really thought about
that yet, I am still trying to determine how to detect whether the
download was succesfull.
Thanks,
Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]