I would like to do a simple mapper:

   - given some inputs, calculate a file path
   - let apache serve out that file for me

Is there a simple example of how to do this?  mod_rewrite
is pretty heavy-duty, and I'd like to get a simpler
model to follow.


Here's what I've got so far, am I on the right track?

Many TIA!
Mark

--------------------------------------------------------------------------------

static int my_mapper(request_rec *r)
{
    mypath = lookup(...); <-- e.g. "/usr/mydir/myfile.mp4"

    ap_set_content_type(r, "video/mp4");
    apr_table_add(r->headers_out, "Content-disposition",
                                  "inline; filename=acad.mp4");


    ap_???(r, mypath); <-- tell apache we want to serve this file
                           do this by setting something in r?

    return ???;      <-- tell apache to continue to the next step
                         and serve out the file
}


static void register_mymapper(apr_pool_t *p)
{
    ap_hook_translate_name(my_mapper,NULL,NULL,APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA mymapper_module = {
    STANDARD20_MODULE_STUFF,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    register_mymapper
};


--
Mark Harrison
Pixar Animation Studios

Reply via email to