William A. Rowe, Jr. wrote:
At 04:34 PM 2/6/2004, [EMAIL PROTECTED] wrote:

Joshua Slive wrote:

And perhaps I'm going way off in left field here, but why should this be
user-configurable at all?  Shouldn't the (for example) server-status
handler know itself that it is a virtual handler, and therefore indicate
that the directory-walk should be skipped?

I like it! assuming we tweak it to be the module's responsibility to declare this property, vs. strictly the handler's (too late)

Modules can do that today with some very trivial code...

I think I see a problem. No doubt it could be made to work with a simple tweak.


SetHandler in the location container sets the handler field in the core "dir" conf during location walk.

map_to_storage runs, but r->handler hasn't been updated due to the SetHandler yet. virtual_map_location doesn't know that it owns this URI.

An unnecessary directory walk happens.

core_override_type runs during the fixups phase and sets r->handler to the handler specified in the <Location > block from the handler field in the core "dir" config. It's too late to affect the directory walk.

Another nit is that every module with virtual content would repeat essentially the same code, other than checking the unique handler name of course, and add to mainline path length on every request by increasing the number of map_to_storage routines. We would depend on each module zapping r->filename. This doesn't bother me for 2.0 if we can save a directory walk.

Greg

static int virtual_map_location(request_rec *r)
{
    int access_status;

/* Test that SetHandler forced to this content * otherwise skip it.
*/
if (strncmp(r->handler, "info-handler") != 0)
return DECLINED;


    /* this info-handler won't deal with the filename
     * so null the filename to ensure no file is served.
     */
    r->filename = "";

    /* Don't let the core map_to_storage hook handle this,
     * We don't need directory/file_walk.  See mod_proxy.c
     * if our own custom <Restrictions > blocks were needed.
     */
    return OK;
}


static void register_hooks(apr_pool_t *p) { ... /* Suppress default dir_walk behavior, our module's * content is virtual. */ ap_hook_map_to_storage(virtual_map_location, NULL, NULL, APR_HOOK_MIDDLE);

}







Reply via email to