Am Sa, 2003-11-29 um 09.49 schrieb John Michael: > But This: > > if ($h->r->connection->aborted) { > > would not be called until this > > $h->r->send_fd($fh); > > were already through. For a large file, wouldn't that it too late. > or would a real aborted connection cause send_fd($fh) to go ahead and stop > sending the file. > > I've been reading through the cookbook and trying to piece this together. > > Say I want to only allow one coneection per ip to a certain folder. > I think I need to create an access handle to determine and monitor whether > to allow someone another connection from their ip. Return OK if they are > allowed, update a list of some sort showing that the ip does have an active > connection. >
Be aware of proxies. Many ISPs use proxies, in this situation your are excluding all people using the same proxy because one of their users is accessing a directory/file. > I need to know where to remove the active connection. > WOuld I then create a handler to run in the logging phase to remove the the > IP from the active connection list. > JM > > > > ----- Original Message ----- > From: "Thomas Klausner" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, November 29, 2003 2:19 AM > Subject: Re: connection monitoring > > > > Hi! > > > > On Sat, Nov 29, 2003 at 02:00:18AM -0600, John Michael wrote: > > > Someone pointed me to checking the connection class for an abort. I > found > > > info on this in the modperl cookbook..That seems useful if you want to > > > server your own files, but would take a lot of overhead if you had to > > > continue to check it for a large file. It would not really do me any > good > > > to serve the file myself if under modperl I would think anyway > > > > I'm not really sure I understand completely what you're after, but > recently > > I had to implement something wich sound similar: Registeres users are > > allowed to download a fixed quantity of mp3 files. If they abort the > > download, their quota shouldn't be decremented. > > > > So I did something like this: > > > > $h->r->send_fd($fh); > > > > if ($h->r->connection->aborted) { > > $h->debug("DOWNLOAD ABBORTED!!"); > > > > # reset download count > > } > > > > return OK; > > > > Obviously, I am serving the mp3-files using a mod_perl enabled Apache. > > > > > > > > -- > > #!/usr/bin/perl http://domm.zsi.at > > for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/} > > > > -- > > Reporting bugs: http://perl.apache.org/bugs/ > > Mail list info: http://perl.apache.org/maillist/modperl.html > > > -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html