You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Brian Gorby <go...@gmail.com> on 2005/08/24 19:08:08 UTC

mod_perl 1.29: send_fh(): result status?

I'm programming a web application that limits the number of downloads 
for clients on certain files:

...
unless ( $r->header_only ) {
   $r->send_fd($fh);
   $self->record_download($user_id, $file_id);
}
close($fh);

I'd like to be able to have some sort of confirmation that the file was 
sent / received in entirety before recording the download; if the 
download times out for whatever reason for the client, the download will 
not be recorded.

Is this something that's possible in general? with mod_perl?

-Brian


Re: mod_perl 1.29: send_fh(): result status?

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2005-08-24 at 13:08 -0400, Brian Gorby wrote:
> I'd like to be able to have some sort of confirmation that the file was 
> sent / received in entirety before recording the download; if the 
> download times out for whatever reason for the client, the download will 
> not be recorded.
> 
> Is this something that's possible in general? with mod_perl?

You can tell if the connection gets closed by the client, but you have
to try sending something to check it.  This is in the documentation.

- Perrin


Re: mod_perl 1.29: send_fh(): result status?

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Brian Gorby wrote:
> I'd like to be able to have some sort of confirmation that the file was 
> sent / received in entirety before recording the download; if the 
> download times out for whatever reason for the client, the download will 
> not be recorded.
> 
> Is this something that's possible in general? with mod_perl?
Why would you want to record the download if you didn't finish sending them the file :)



-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


Re: mod_perl 1.29: send_fh(): result status?

Posted by Brian Gorby <go...@gmail.com>.
Brian Gorby wrote:
> Is this something that's possible in general? with mod_perl?

Found it. Apache::Connection->aborted() is just what I needed.

-Brian