I'm writing an Apache module and that i have encounter some confusion concerning the behavior from the directory configuration merge function.

Within the source for mod_example, the parameters are labelled such as this:

static void *x_merge_dir_config(apr_pool_t *p, void *parent_conf, void *newloc_conf);

But given directives such as this:

<Location /path/>
  MyOption value-from-path

<Location />
  MyOption value-from-root

If this function is known as consequently of the use of http://localhost/path/, the function is known as with parent_conf originating from /path/ and newloc_conf originating from /, which is the complete opposite of things i would expect in line with the names of those parameters. I'd describe "/" because the parent and "/blog/" because the child/subordinate/most specific path.

I am trying to puzzle out exactly what the real story is here now. Is Apache while using word "parent" in a different way than I actually do? Has mod_example erroneously misnamed these parameters? Shall We Be Held simply confused?

When I comprehend it the "parent"/"new" args convey more related to an order by which Apache is applicable configuration directives compared to pathnames connected with individuals directives. You may already know it begins using the per-server, then vhost, then Location sections, etc., with later directives within this list overriding earlier ones. And also the job from the merge callback would be to compute caused by overriding the stuff in "parent" using the stuff in "newloc".

If multiple Location sections match a request, they are applied in the order they appear in the config file. Therefore, when MyOption value-from-root is merged in, it's the "new" bit of configuration— it's being applied after value-from-path— so it's within the "newloc" arg, and also the configuration calculated as much as that time, including value-from-path, is within "parent".

(Being an aside, unless of course your module comes with an unusual merge behavior, which means you most likely wish to swap an order of these two Location sections. The 2nd one, for root, will always apply, and can most probably prevent the first from ever getting an obvious effect.)