MCPcopy Create free account
hub / github.com/apache/httpd / x_merge_dir_config

Function x_merge_dir_config

modules/examples/mod_example_hooks.c:590–627  ·  view source on GitHub ↗

* This function gets called to merge two per-directory configuration * records. This is typically done to cope with things like .htaccess files * or directives for directories that are beneath one for which a * configuration record was already created. The routine has the * responsibility of creating a new record and merging the contents of the * other two into it appropriately.

Source from the content-addressed store, hash-verified

588 * containing the merged values.
589 */
590static void *x_merge_dir_config(apr_pool_t *p, void *parent_conf,
591 void *newloc_conf)
592{
593
594 x_cfg *merged_config = (x_cfg *) apr_pcalloc(p, sizeof(x_cfg));
595 x_cfg *pconf = (x_cfg *) parent_conf;
596 x_cfg *nconf = (x_cfg *) newloc_conf;
597 char *note;
598
599 /*
600 * Some things get copied directly from the more-specific record, rather
601 * than getting merged.
602 */
603 merged_config->local = nconf->local;
604 merged_config->loc = apr_pstrdup(p, nconf->loc);
605 /*
606 * Others, like the setting of the `congenital' flag, get ORed in. The
607 * setting of that particular flag, for instance, is TRUE if it was ever
608 * true anywhere in the upstream configuration.
609 */
610 merged_config->congenital = (pconf->congenital | pconf->local);
611 /*
612 * If we're merging records for two different types of environment (server
613 * and directory), mark the new record appropriately. Otherwise, inherit
614 * the current value.
615 */
616 merged_config->cmode =
617 (pconf->cmode == nconf->cmode) ? pconf->cmode : CONFIG_MODE_COMBO;
618 /*
619 * Now just record our being called in the trace list. Include the
620 * locations we were asked to merge.
621 */
622 note = apr_psprintf(p, "x_merge_dir_config(p == %pp, parent_conf == "
623 "%pp, newloc_conf == %pp)", (void*) p,
624 (void*) parent_conf, (void*) newloc_conf);
625 trace_startup(p, NULL, merged_config, note);
626 return (void *) merged_config;
627}
628
629/*
630 * This function gets called to create a per-server configuration

Callers

nothing calls this directly

Calls 1

trace_startupFunction · 0.85

Tested by

no test coverage detected