You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Akins <ba...@web.turner.com> on 2003/04/08 21:40:55 UTC

map_to_storage & per_dir_config

Why is this done in server/request.c ?

/* Reset to the server default config prior to running map_to_storage
     */
    r->per_dir_config = r->server->lookup_defaults;

    if ((access_status = ap_run_map_to_storage(r))) {
        /* This request wasn't in storage (e.g. TRACE) */
        return access_status;
    }


What's the reason for reseting to config default?


ap_internal_fast_redirect was: map_to_storage & per_dir_config

Posted by Brian Akins <ba...@web.turner.com>.
On Wed, 09 Apr 2003 10:53:51 -0500
"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:

> That said, your description suggests also that you really wanted
> to use either translate_name, or later in ap_run_access_checker
> or ap_run_check_user_id.


Yep, translate_name is what I really wanted.  I got a hint from the
mod_file_cache.c

Thanks 


Also, new question:

Shouldn't ap_internal_fast_redirect also copy the request_config?  It
copies almost everything but that...

--Brian


Re: map_to_storage & per_dir_config

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 08:56 AM 4/9/2003, Brian Akins wrote:
>On Tue, 08 Apr 2003 15:02:17 -0500
>"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:
>
>> We reset to the new vhost server config, then apply dir, file, and
>> location blocks (in that order) for typical file-based requests.
>
>Just makes it a pain if I have a module that uses the map_to_storage
>hook and I want to use per_dir configs...

Because you the have the default per_dir config and can merge in
whatever new per_dir sections you want.  See what mod_proxy does
to offer <proxy > blocks, for example.

The *entire* point of map_to_storage is to connect a resource name
(figured out back in translate_name) to a real resource, and construct
the appropriate per_dir config.

And you can even use it... look at where in that hook you want to have
an impact before or after some sections are merged.  Better yet - you
can return OK if it is ok, as proxy does, to entirely avoid running
other filesystem based mappers when your module isn't serving files.
The sections are merged in map_to_storage at;

They happen in this order;

ap_hook_map_to_storage:
    proxy_map_location APR_HOOK_FIRST
    ap_send_http_trace APR_HOOK_MIDDLE
    core_map_to_storage APR_HOOK_REALLY_LAST

Your comments point out that core_map_to_storage should have
been APR_HOOK_LAST, so that others could register later still.

That said, your description suggests also that you really wanted
to use either translate_name, or later in ap_run_access_checker
or ap_run_check_user_id.

Bill 


Re: map_to_storage & per_dir_config

Posted by Brian Akins <ba...@web.turner.com>.
On Tue, 08 Apr 2003 15:02:17 -0500
"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:

> We reset to the new vhost server config, then apply dir, file, and
> location blocks (in that order) for typical file-based requests.

Just makes it a pain if I have a module that uses the map_to_storage
hook and I want to use per_dir configs...


Thanks.

--Brian

Re: map_to_storage & per_dir_config

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 02:40 PM 4/8/2003, Brian Akins wrote:
>Why is this done in server/request.c ?
>
>/* Reset to the server default config prior to running map_to_storage
>     */
>    r->per_dir_config = r->server->lookup_defaults;
>
>    if ((access_status = ap_run_map_to_storage(r))) {
>        /* This request wasn't in storage (e.g. TRACE) */
>        return access_status;
>    }
>
>What's the reason for reseting to config default?

Because the pre-negotiation phase quite possibly rearranged the virtual
host associated with the request in ap_run_translate_name.

We reset to the new vhost server config, then apply dir, file, and location
blocks (in that order) for typical file-based requests.

I should point out this is the *identical* behavior to Apache 1.3 - see
it's directory_walk() code and comments.

Bill