Re: pass-thru/redirect/DECLINE to *.jpg

2002-12-18 Thread Geoffrey Young



my $fh=$pic-open; #returns the filehandle
$r-send_fd($fh);
close($fh);
return OK;

I used send_fd because it seemed from the documentation that it is a
easier/better(?) method than rewriting the URI and setting default-handler.
Is that not so?


if you were to use default-handler then Apache would handle stuff like conditional GETs 
properly, relieving your server from needing to serve the same content over and over again 
for images, which probably don't change that often.

of course, you can use the methods from Apache::File, like meets_conditions() and 
set_last_modified() to do that yourself and still use send_fd() :)

--Geoff




pass-thru/redirect/DECLINE to *.jpg

2002-12-17 Thread Aaron J Mackey

I have a completely mod_perl handler-based web app set up as so:

Location ~ ^/myapp
PerlHandler Client::WWW
SetHandler  perl-script
PerlSetVar  ConfigFile /home/ajm6q/myapp/data/www-config
/Location

The Client::WWW handler decides what to do based on the path_info of the
URI (passing off responsibility in a ChainOfResponsibility pattern):

http://www.mysite.com/myapp - home
 /myapp/newuser - new user functionality
 /myapp/deluser - delete user functionliaty

And so on.  What I'm having difficulty grasping is how to best handle
image, js, css or other static resource requests that fall under the
^/myapp Location ... Client::WWW is currently trying to handle
http://mysite.com/myapp/images/dot.gif

To further complicate issues, the ConfigFile contains information about
where various resources reside (perhaps /home/ajm6q/myapp/data/images for
example).  These are not under the server's DocumentRoot.

I think my options are:

1. Reset the DocumentRoot in each Location to point to
/home/ajm6q/myapp/data/, and have Client::WWW return DECLINED if the
request is for a static resource, so that the request will drop back to
Apache ... not sure this would even work, and makes the config file
a tad worthless.

2. Install a translation handler that sets the filename of the request
appropriately; not sure if this would prevent Client::WWW from handling
the request, but would allow a DECLINED drop back to Apache to work
without mucking with DocumentRoot ... I think.

3. Have Client::WWW do a subrequest (via lookup_file), and run that
directly.

4. ???

TIMTOWTDI is getting me down right about now.

Thanks for your advice,

-Aaron




Re: pass-thru/redirect/DECLINE to *.jpg

2002-12-17 Thread Ged Haywood
Hi there,

On Tue, 17 Dec 2002, Aaron J Mackey wrote:

 
 I have a completely mod_perl handler-based web app set up as so:
 
 Location ~ ^/myapp
 PerlHandler Client::WWW
 SetHandler  perl-script
 PerlSetVar  ConfigFile /home/ajm6q/myapp/data/www-config
 /Location

 [snip]  What I'm having difficulty grasping is how to best handle
 image, js, css or other static resource requests that fall under the
 ^/myapp Location

I'd tend to put image files etc in a directory of their own outside
any which might be involved in Perl scripting, thus avoiding this issue.
Is that not easy in your case?

It seems a bit wasteful to have a mod_perl Apache process involved at
all in serving .jpg and other static files.  Why not run a two-Apache
setup and let the non-mod_perl server serve them without even letting
a heavyweight process see the request?  It's described in the Guide.

73,
Ged.




Re: pass-thru/redirect/DECLINE to *.jpg

2002-12-17 Thread Issac Goldstand
From: Ged Haywood [EMAIL PROTECTED]
 It seems a bit wasteful to have a mod_perl Apache process involved at
 all in serving .jpg and other static files.  Why not run a two-Apache
 setup and let the non-mod_perl server serve them without even letting
 a heavyweight process see the request?  It's described in the Guide.

Not necessarily.  There are always exceptions.  For example, take a look at
http://pics.beamartyr.net/  All of the pictures there go through mod_perl
handlers which translate the entire path into a unique database entry.  The
application then stats the file on the filesystem, and does:

my $fh=$pic-open; #returns the filehandle
$r-send_fd($fh);
close($fh);
return OK;

I used send_fd because it seemed from the documentation that it is a
easier/better(?) method than rewriting the URI and setting default-handler.
Is that not so?

  Issac