httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: FileSystem v.s. Other Resources [was configurable Location?]
Date Sun, 08 Feb 2004 02:21:38 GMT
At 04:34 PM 2/6/2004, gregames@apache.org wrote:
>Joshua Slive wrote:
>>>I do, however, agree that doing a directory-walk on virtual resources is
>>>not nice.  But my opinion is that "virtualness" is a property of the
>>>resource, and hence should be designated when selecting the resource.
>>>That is why I suggested changing SetHandler rather than <Location>.
>>
>>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...






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);

}



Mime
View raw message