Once more connection monitoring
>> 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'm not worried about this aspect. I'm going to validate using cookies andcan use cookies along with their ip, user agent, and lang var to come up with a scheme.I'm more worried about whether or not I am on the right track with thissection of code layout. IF i wanted to allow a validated user to download one file at a time from a certain folder sub handler { # validate user first to see if they belong in this area # check and see if this user already has an active connection and is currently downloading a file by maintaining this information in some way(memory cache, flat file, db)don't know or can you poll the active connections on the server or would that take too more resources # if already active return FORBIDDEN else # add user to active connections list if not already active $r->push_handlers(PerlCleanupHandler => \&cleanup); return OK;}sub cleanup { # remove active connections here b/c I won't be called until either the file is through being sent or user terminated connection freeing up services for this user to download another file}Is this correct.John Michael
Re: mod_perl and Apache::Registry
Randy Kobes wrote: On Thu, 27 Nov 2003, Stas Bekman wrote: Randy Kobes wrote: [...] I think it is a ModPerl::BuildMM thing - this patch [ .. ] arranges for everything to be put under an Apache2/. Cool. Though, it's probably easier to read: $v =~ s{(blib([/\\])lib)}{$1$2Apache2}; or even: $v =~ s{ (blib[/\\]lib) }{ catdir $1, 'Apache2'}xe; I thought there is at least one more variation of the dir separator, wasn't it ':'? Good point - how about === Index: lib/ModPerl/BuildMM.pm +1, though probably also drop the () as they aren't needed now that File::Spec imports the functions. -my $apache_test_dir = File::Spec->catdir(Cwd::getcwd(), "Apache-Test", "lib"); +my $apache_test_dir = catdir Cwd::getcwd(), "Apache-Test", "lib"; etc... to be consistent with the rest of the code. -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Once more connection monitoring
> I'm more worried about whether or not I am on the right track with this > section of code layout. > > IF i wanted to allow a validated user to download one file at a time > from a certain folder sub handler { ># validate user first to see if they belong in this area ># check and see if this user already has an active connection and is >currently downloading a file by maintaining this information in some >way(memory cache, flat file, db)don't know or can you poll the >active connections on the server or would that take too more >resources If you're concerned about speed, putting the data in MySQL, IPC::MM, or BerkeleyDB should be fast enough. Only MySQL in that list will work for multiple machines. > sub cleanup { ># remove active connections here b/c I won't be called until either >the file is through being sent or user terminated connection freeing >up services for this user to download another file A cleanup handler is the right place to do it, but you typically don't get interrupted when the user terminates the connection. Read more here:http://perl.apache.org/docs/1.0/guide/debug.html#Handling_the__User_pressed_Stop_button__case - Perrin -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html