httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Carleton" <scarle...@gmail.com>
Subject Re: translate_name and/or map_to_storage hooks
Date Thu, 05 Apr 2007 12:58:06 GMT
On 4/5/07, Graham Dumpleton <graham.dumpleton@gmail.com> wrote:
> On 05/04/07, Sam Carleton <scarleton@gmail.com> wrote:
> >
> > I have one module that does a few different things.
> >
> > 1: create a index html document of images
> > 2: create a page html document of one image (when user clicks on an
> > image in the index)
> > 3: Handle the image request that are in the HTML of #1 and #2 and send
> > out all the images.
> >
> > Right now I have it all written in PHP, there is a index.php for #1
> > and #2 and an imageHandler.php for #3.  I am trying to understand the
> > best way to separate this logic within my one module.  Someone else
> > suggested I look at hooking translate_name.
> >
> > I found my answer to how to determine the location, so I have been
> > playing with it since my post and when I set the r->filename =
> > "images"; and return OK, I get a 403 Forbidden.
>
> Probably because you haven't allowed Apache access to the images
> directory. Ie., you still need to have something like:

For starters, the objective is to do away with the PHP code
altogether, I don't think I will do that in the first round, just
replace the image handler, but I am thinking long term;)

The way I have it configured is this:

<Location /coolapp>
    SetHandler mod_my_cool_app
<Location>

I don't understand your comment about not allowing Apache access to
the images directory, for starters, from the perspective of Apache,
there isn't an images directory, it is elsewhere on the machine that
Apache does not have and will not have access to, it is a security
thing.

But I don't think that is really relevant to the problem.  When I type
in /coolapp/images in a browser, my module does get called and the URI
is /coolapp/images, why is it when I simply set the request's filename
(r->filename) to "images" I get a 403?  Apache did not have a problem
with /coolapp/images, why would it have a problem with
/coolapp/images/images?  Or does filename mean something different?

As I have told others on this wonderful mailing list, my 12+ years of
software development have been in GUI development, not web.  I have
always played with web stuff, but this is my first serious web project
and it is for my own new company!

Ultimately I am trying to figure out, within the world of Apache
modules, what is the best way to distinguish between the different
"general" flow paths in my module.  One being to generate HTML and the
other to generate images.  To the end user, I would like the URI for
pages to simply be <location>/ and the URI for the images to be
<location>/images.

As it stands right now, I am thinking the easiest way is to simply
check to see if the URI is <location> or <location>/images inside of
the main handler.  Someone else said that the right way to do it is to
do this checking in the translate_name hook.  Unless I am able to be
enlightened, which is questionable<grin>, I think I will do it the
first way:(

Sam

Mime
View raw message