Re: keeping client images private
I'm afraid I'm not familiar (although aware of) Mason, so I can't help you in that context. I wrote something similar a while ago. When a user uploads the image file it goes into a common directory that contains all images. The file name is renamed to the following format: . The checksum ensures that all filenames are unique and offers a quick way to check if an images has already been uploaded (just gen a checksum of the images uploaded and check if the file already exists in the images directory). This also offers a way to have a single copy of an image where multiple users may have uploaded the same image. Once the image has been stored, I write an entry for each file in a table in an RDBMS (mysql) which contains the file name (checksum.extention), description, original file name of the image, date uploaded, time last viewed, number of hits etc...etc... Then just write an apache handler that provides a virtual directory structure to view each users images. e.g. http://example.com/images/mark/image1.jpg will be intercepted by the handler. Handler checks if user is logged in and has access to /images/mark and if all checks out ok, then handler fetches image1.jpg's information from the database, fetches the corresponding . file and returns an image/jpeg (or image/gif or whatever) You can also do some funky stuff like use Image::Magick to generate thumbnails on the fly which are cached in a seperate directory. So the first time a thumbnail is accessed, you generate it dynamically, the second time it is served from the directory cache. You also store the thumbnails as a checksum of the original image (perhaps with a different extension) so that if the original changes, the thumbnail will have to be regenerated. (Sorry if the above seems a little unstructured - just a brain dump really). ~mark will trillich wrote: > y'all seem to have some clever brains out here, so i'm wondering > if some of you can offer suggestions-- > > what's a good clean way to keep images private per customer? > > i'm using mod_perl and HTML::Mason with session cookies, but > coming up with a paradigm for storing and revealing images > privately has got me a bit flummoxed. > > mr. smith has pix which he can see when he logs in to the > website, and mr. brown has pix of his own, but neither can > see the other's images. each customer can have two levels of > imagery (main images/subsidiary images). > > i could have a handler intercept image requests and deny access > if session->user isn't valid ... should i just make an apache > alias to handle images as if they're from a certain subdir? and > then use mod_perl to redirect the requests to the actual images > internally? > > or actually store the images in actual subdirs of the > documentroot? > > is there a better/faster/cheaper way? > > i'm sure there's more than one way to do this -- and before i > take the likely-to-be-most-circuituitous route, i thought i'd > cull advice from the clever minds on this list... > > -- > [EMAIL PROTECTED] > http://sourceforge.net/projects/newbiedoc -- we need your brain! > http://www.dontUthink.com/ -- your brain needs us! -- Mark Maunder Senior Architect SwiftCamel Software http://www.swiftcamel.com mailto:[EMAIL PROTECTED]
Re: keeping client images private
will trillich <[EMAIL PROTECTED]> writes: > i'm sure there's more than one way to do this -- and before i > take the likely-to-be-most-circuituitous route, i thought i'd > cull advice from the clever minds on this list... Take a look at the mod_rewrite cookbook...there's some neat stuff in there. -- David Hodgkinson, Wizard for Hirehttp://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Interim Technical Director, Web Architecture Consultant for hire
Error using mod perl
Hi I've succeeded builded, tested and installed the following modules: DBI-version 1.13 DBD-Oracle version 1.06 Apache::DBI version 0.87 Im using Oracle8i (8.1.7.0.0) DB. But at the moment in which i try to use my perl script i receive in error_log the following message: Can't call method "prepare" on an undefined value at /usr/local/apache/perl/lib/ site_perl/5.005/sun4-solaris/Oraperl.pm line 121." - I've just set the PerlSetEnv PERL5LIB in httpd.conf of Apache Web Server with the proper values but it seems not to be working properly. $ perl -v This is perl, version 5.005_03 built for sun4-solaris $ perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=solaris, osvers=2.6, archname=sun4-solaris uname='sunos pdsun-build7 5.6 generic_105181-14 sun4u sparc sunw,ultra-60 ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='/opt/SUNWspro/SC4.0/bin/cc', optimize=' -xO4 -KPIC', gccversion= cppflags='-I/usr/local/include' ccflags ='-I/usr/local/include' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='/usr/ccs/bin/ld', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc -lcrypt libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc="dl_dlopen.xs," dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib' Characteristics of this binary (from libperl): Built under solaris Compiled at Aug 14 2000 20:04:34 @INC: /usr/local/apache/perl/lib/5.00503/sun4-solaris /usr/local/apache/perl/lib/5.00503 /usr/local/apache/perl/lib/site_perl/5.005/sun4-solaris /usr/local/apache/perl/lib/site_perl/5.005 . Thanks a lot --- Fl@vio D' Amore DATAMAT S.p.A. Via Laurentina 760 00143 Rome - Italy DATASIM - Product Support Phone: +39-06-50.27.4350
Re: AxKit & Last-Modified header
On Mon, 2001-09-10 at 16:19, Brian Wheeler wrote: > The only difference between the two (request-wise) is that static pages > return a "Last-Modified" header and dynamic data doesn't. It seems to > me that if I drop that header, everything will work :) > > I've tried doing: > > $r->header_out("Last-Modified"=>''); > and > $r->header_out("Last-Modified"=>undef); > > but the header still comes out. > > Thoughts? Am I on the right track? Do not remove Last-Modified. Add an Expires (Maybe even 1970). If the page is expired, the browser will rerequest it with an If-Modified-Since. So you can still play the 304 game. Hth, Joachim
Re: AxKit & Last-Modified header
On Wed, 2001-09-12 at 19:34, J. Zobel wrote: > On Mon, 2001-09-10 at 16:19, Brian Wheeler wrote: > > > The only difference between the two (request-wise) is that static pages > > return a "Last-Modified" header and dynamic data doesn't. It seems to > > me that if I drop that header, everything will work :) > > > > I've tried doing: > > > > $r->header_out("Last-Modified"=>''); > > and > > $r->header_out("Last-Modified"=>undef); > > > > but the header still comes out. > > > > Thoughts? Am I on the right track? > > Do not remove Last-Modified. > Add an Expires (Maybe even 1970). > > If the page is expired, the browser will rerequest it with an > If-Modified-Since. So you can still play the 304 game. > > Hth, > Joachim > No such luck...the browser continues to use the cached copy. Brian
Pre-announce Apache::ConfigParser
Hello, This is a preannounce of Apache::ConfigParser. I wrote this to allow programs separate from Apache to completely understand, parse and manipulate Apache configuration files. The interface is not simple, but it allows for more complicated understanding of log files, such as finding the associated ServerName for log files. There are two separate modules described here. The first manages a single directive and the second assembles these into an object that represents a complete configuration file. Comments welcome, including the name of the module. It's available now at http://www.orcaware.com/perl/Apache-ConfigParser-0.01.tar.gz and will be up on CPAN if there are no serious comments. Regards, Blair NAME Apache::ConfigParser::Directive - An Apache directive or start context SYNOPSIS use Apache::ConfigParser::Directive; # Create a new emtpy directive. my $d = Apache::ConfigParser::Directive->new; # Make it a ServerRoot directive. # ServerRoot /etc/httpd $d->name('ServerRoot'); $d->value('/etc/httpd'); # A more complicated directive. Value automatically splits the # argument into separate elements. It treats elements in "'s as a # single ement. # LogFormat "%h %l %u %t \"%r\" %>s %b" common $d->name('LogFormat'); $d->value('"%h %l %u %t \"%r\" %>s %b" common'); # Get a string form of the name. # Prints `logformat'. print $d->name, "\n"; # Get a string form of the value. # Prints `"%h %l %u %t \"%r\" %>s %b" common'. print $d->value, "\n"; # Get the values separated into individual elements. Whitespace # separated elements that are enclosed in "'s are treated as a # single element. Protected quotes, \", are honored to not begin or # end a value element. In this form protected "'s, \", are no # longer protected. my @value = $d->get_value_array; scalar @value == 2; # There are two elements in this array. $value[0] eq '%h %l %u %t \"%r\" %>s %b'; $value[1] eq 'common'; # The array form can also be set. Change style of LogFormat from a # common to a referer style log. $d->set_value_array('%{Referer}i -> %U', 'referer'); # This is equivalent. $d->value('"%{Referer}i -> %U" referer'); # There are also an equivalent pair of values that are called # `original' that can be accessed via orig_value, # get_orig_value_array and set_orig_value_array. $d->orig_value('"%{User-agent}i" agent'); $d->set_orig_value_array('%{User-agent}i', 'agent'); @value = $d->get_orig_value_array; scalar @value == 2; # There are two elements in this array. $value[0] eq '%{User-agent}i'; $value[1] eq 'agent'; # You can set undef values for the strings. $d->value(undef); DESCRIPTION The "Apache::ConfigParser::Directive" module is a subclass of "Tree::DAG_Node", which provides methods to represents nodes in a tree. Each node is a single Apache configura tion directive or root node for a context, such as or . All of the methods in that module are available here. This module adds some additional methods that make it easier to represent Apache directives and contexts. This module holds a directive or context: name value in string form value in array form a separate value termed `original' in string form a separate value termed `original' in array form the filename where the directive was set the line number in the filename where the directive was set The `original' value is separate from the non-`original' value and the methods to operate on the two sets of values have distinct names. The `original' value can be used to store the original value of a directive while the non-`directive' value can be a modified form, such as changing the CustomLog filename to make it absolute. The actual use of these two distinct values is up to the caller as this module does not link the two in any way. METHODS The following methods are available: $d = Apache::ConfigParser::Directive->new; This creates a brand new "Apache::ConfigParser::Direc tive" object. It is not recommended to pass any arguments to "new" to set the internal state and instead use the follow ing methods. There actually is no "new" method in the "Apache::Con figParser::Directive" module. Instead, due to "Apache::ConfigParser::Directive" being a subclass of "Tree::DAG_Node", "Tree::DAG_Node::new" will be used. $d->name $d->name($
Re: AxKit & Last-Modified header
On Wed, 2001-09-12 at 19:34, J. Zobel wrote: > On Mon, 2001-09-10 at 16:19, Brian Wheeler wrote: > > > The only difference between the two (request-wise) is that static pages > > return a "Last-Modified" header and dynamic data doesn't. It seems to > > me that if I drop that header, everything will work :) > > > > I've tried doing: > > > > $r->header_out("Last-Modified"=>''); > > and > > $r->header_out("Last-Modified"=>undef); > > > > but the header still comes out. > > > > Thoughts? Am I on the right track? > > Do not remove Last-Modified. > Add an Expires (Maybe even 1970). > > If the page is expired, the browser will rerequest it with an > If-Modified-Since. So you can still play the 304 game. > > Hth, > Joachim > Wait...maybe it did work. :) I think my 'log out' procedure is broken, but it works ok for the 'log in' part :) Thanks! Brian
Segmentation Fault problems
I posted this earlier and have received no replies. Am I missing crucial information? - I've been getting this error... [Thu Aug 30 17:32:54 2001] [notice] child pid 24891 exit signal Segmentation Fault (11) on just about any request. Not consistently though. I ran Apache in single server mode using Apache::DB and here is what is happening... Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:30): 30: return @_ if ref $_[0]; Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:31): 31: my $error = join '', @_; Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:32): 32: my $mess = ""; Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:33): 33: my $i = 1 + $CarpLevel; Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:34): 34: my ($pack,$file,$line,$sub,$hargs,$eval,$require); Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:35): 35: my (@a); Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:39): 39: while (do { { package DB; @a = caller($i++) } } ) { Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:39): 39: while (do { { package DB; @a = caller($i++) } } ) { Carp::longmess_heavy(/usr/local/lib/perl5/5.6.1/Carp/Heavy.pm:124): 124:$mess || $error; Signal SEGV: No such file or directory Abort I saw a similar thing in the mailing list archives. There was a patch posted in response for perl 5.6.0 but I'm running 5.6.1 Any help would be appreciated! Thanks. Here is some info: Solaris 8 (SunOS 5.8) Apache/1.3.12 (Unix) mod_perl/1.24_01 mod_ssl/2.6.5 OpenSSL/0.9.4 Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos dev1 5.8 generic_108528-02 sun4u sparc sunw,ultra-2 ' config_args='-ds -e -Uuselargefiles' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include', optimize='-O', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.2 19991024 (release)', gccosandvers='solaris2.8' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: Built under solaris Compiled at Aug 30 2001 17:04:47 @INC: /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl . -- Brian Cocks Senior Software Architect Multi-Ad Services, Inc. [EMAIL PROTECTED] (309)690-5834
RE: Pre-announce Apache::ConfigParser
>-Original Message- >From: Blair Zajac >To: [EMAIL PROTECTED] >Sent: 9/12/01 5:41 PM >Subject: Pre-announce Apache::ConfigParser > >Hello, > >This is a preannounce of Apache::ConfigParser. I wrote this to >allow programs separate from Apache to completely understand, >parse and manipulate Apache configuration files. BTW, I appreciate you posting an RFC, mainly because I feel as though the Apache module list has grown rapidly of late (which is not necessarily a bad thing) but grown without that many RFCs, feedback, or attempts to build on what others have already done. that said, is this all that different from CPAN/modules/by-module/Apache/Apache-Admin-Config-0.05.tar.gz ? I swore there was yet a third candidate in this realm, but I didn't see it on brief inspection. at any rate, can the two somehow be integrated into some mutually acceptable module? --Geoff
Re: Pre-announce Apache::ConfigParser
I missed the Apache-Admin-Config module in my search for Apache config file parsers, otherwise I would have not written a new one :) The other parser was just announced after I finished this one is named Apache::ConfigFile. All three modules appear to treat the directives and contexts the same, in that you can descend into the contexts to get directive's specified there. They could definitely be merged into a single module that does what everybody needs. I don't have the time to do this myself, but would could help out. A common API would have to be designed so that it would have all of the features people needed. Here's a quick review of the pluses and minuses of the tree modules (obviously pro Apache::ConfigParser because it has the features I need). Apache::Admin::Config Pros Cons Lack of documentation Test suite with 2 tests Apache::ConfigFile Pros Clear interface Good documentation Handles mod_perl config directives Overloaded method names to get config values Automatic boolean conversion Been around for a while Cons Test suite with one test Apache::ConfigParser Pro Good documentation Build tree structure of config allowing complicated searches Parses config file exactly as Apache does Knows which directives can take relative path names and makes them absolute automatically Correctly parses directive values with "'s and \"'s Allows searches on directives regardless of context Allows searches up through context levels Extensive test suite Keeps track of where directives were set Cons Doesn't write out config files No autoloaded calls Not easily used interface Is it possible to remove CPAN modules when a common interface is built? Blair Geoffrey Young wrote: > > > > >-Original Message- > >From: Blair Zajac > >To: [EMAIL PROTECTED] > >Sent: 9/12/01 5:41 PM > >Subject: Pre-announce Apache::ConfigParser > > > >Hello, > > > >This is a preannounce of Apache::ConfigParser. I wrote this to > >allow programs separate from Apache to completely understand, > >parse and manipulate Apache configuration files. > > BTW, I appreciate you posting an RFC, mainly because I feel as though the > Apache module list has grown rapidly of late (which is not necessarily a bad > thing) but grown without that many RFCs, feedback, or attempts to build on > what others have already done. > > that said, is this all that different from > CPAN/modules/by-module/Apache/Apache-Admin-Config-0.05.tar.gz > ? > > I swore there was yet a third candidate in this realm, but I didn't see it > on brief inspection. > > at any rate, can the two somehow be integrated into some mutually acceptable > module? > > --Geoff
RE: Pre-announce Apache::ConfigParser
I'll let the other module authors answer your API questions - I was merely starting the dialogue :) >Is it possible to remove CPAN modules when a common interface is built? yes, PAUSE has a delete interface, which removes them from the various CPAN mirrors. there is also an archive project going on at PAUSE somewhere, which has all the modules every uploaded (or something like that) I have a module or two out there I ought to clean up myself ;) --Geoff
DBI connections build up..
Greetings, I am having a problem with a module im writing connecting to the database everytime its run, and not cleaning up the database connection when its finished. I have tried the 2 scenarios below and as yet i cannot work out how to stop the connections building up and eventually causing mysqld to crash. Scenario 1: in the script: (NB: this is not the entire script.. just snippets to show what im trying to achive). use strict; use vars ($dbh); use mod_perl; use DBI; sub config { . $dbh ||= &dbi_connect; } sub dbi_connect { my $an = $C{'auth_name'}; my $dbh = DBI->connect("$C{$an}{'TicketDB'}", "$C{$an}{'TicketDBUser'}", "$C{$an}{'TicketDBPassword'}") or die "Couldn't connect to database: $!"; return $dbh;} sub login_handler { my ($self, $r) = @_; &config($r); } 1; END { $dbh->disconnect; } Scenario 2: same script as above, except Apache::DBI was used... the result is the same.. the database connections just keep building up. Please help, i dont know if i have been descriptive enough about the problem. But I need to resolve this, as when the site gets a few visits.. mysql and apache crash from having too many connections to the database. DJ Webmastery.
Re: DBI connections build up..
On Thu, 13 Sep 2001, DJ (David J Radunz) wrote: > use strict; > use vars ($dbh); You don't need this with Apache::DBI. Globals in general should be avoided/used with extreme caution. > use mod_perl; Don't need this either. > 1; > END { > $dbh->disconnect; > } Put this before the '1;' or just don't use it. Read the guide front to back: http://perl.apache.org/guide/ HTH. Jeff -- Jeff Beard ___ Web:www.cyberxape.com Email: jeff at cyberxape dot com Earth: Boulder, CO, USA