static void *domaintree_merge_srv(apr_pool_t *p, void *old_cfg_ptr, void *new_cfg_ptr) { MDT_CNF *old_cfg = (MDT_CNF *) old_cfg_ptr, *new_cfg = (MDT_CNF *) new_cfg_ptr; MDT_CNF *DT = (MDT_CNF *) apr_palloc(p, sizeof(MDT_CNF)); DT->server = new_cfg->server; DT->enabled = IF_SET_ELSE(new_cfg->enabled, old_cfg->enabled); DT->stripwww = IF_SET_ELSE(new_cfg->stripwww, old_cfg->stripwww); DT->statroot = IF_SET_ELSE(new_cfg->statroot, old_cfg->statroot); DT->maxdepth = IF_SET_ELSE(new_cfg->maxdepth, old_cfg->maxdepth); DT->prefix = EMPTY(new_cfg->prefix) ? EMPTY(old_cfg->prefix) ? "/var/www" : old_cfg->prefix : new_cfg->prefix; DT->suffix = EMPTY(new_cfg->suffix) ? EMPTY(old_cfg->suffix) ? "public_html" : old_cfg->suffix : new_cfg->suffix; DT->ignore = apr_array_append(p, new_cfg->ignore, old_cfg->ignore); DT->forbid = apr_array_append(p, new_cfg->forbid, old_cfg->forbid); #ifdef HAVE_UNIX_SUEXEC DT->suexec = apr_array_append(p, new_cfg->suexec, old_cfg->suexec); #endif DT->aliases.recursion = IF_SET_ELSE(new_cfg->aliases.recursion, old_cfg->aliases.recursion); DT->aliases.faketable = apr_table_overlay(p, new_cfg->aliases.faketable, old_cfg->aliases.faketable); DT->dircache.clim = IF_SET_ELSE(new_cfg->dircache.clim, old_cfg->dircache.clim); DT->dircache.hmap = apr_hash_overlay(p, new_cfg->dircache.hmap, old_cfg->dircache.hmap); apr_global_mutex_create(&new_cfg->dircache.lock, __FILE__, APR_LOCK_DEFAULT, p); #if DBG fprintf(stderr, "MDT: cfg merge %p + %p = %p\n", old_cfg, new_cfg, DT); #endif return DT; }
static void *merge_substitute_dcfg(apr_pool_t *p, void *basev, void *overv) { subst_dir_conf *a = (subst_dir_conf *) apr_palloc(p, sizeof(subst_dir_conf)); subst_dir_conf *base = (subst_dir_conf *) basev; subst_dir_conf *over = (subst_dir_conf *) overv; a->inherit_before = (over->inherit_before != -1) ? over->inherit_before : base->inherit_before; /* SubstituteInheritBefore wasn't the default behavior until 2.5.x, * and may be re-disabled as desired; the original default behavior * was to apply inherited subst patterns after locally scoped patterns. * In later 2.2 and 2.4 versions, SubstituteInheritBefore may be toggled * 'on' to follow the corrected/expected behavior, without violating POLS. */ if (a->inherit_before == 1) { a->patterns = apr_array_append(p, base->patterns, over->patterns); } else { a->patterns = apr_array_append(p, over->patterns, base->patterns); } a->max_line_length = over->max_line_length_set ? over->max_line_length : base->max_line_length; a->max_line_length_set = over->max_line_length_set | base->max_line_length_set; return a; }
static void *merge_substitute_dcfg(apr_pool_t *p, void *basev, void *overv) { subst_dir_conf *a = (subst_dir_conf *) apr_pcalloc(p, sizeof(subst_dir_conf)); subst_dir_conf *base = (subst_dir_conf *) basev; subst_dir_conf *over = (subst_dir_conf *) overv; a->patterns = apr_array_append(p, over->patterns, base->patterns); return a; }
static void *merge_config(apr_pool_t *p, void *basev, void *overridesv) { connect_conf *c = apr_pcalloc(p, sizeof(connect_conf)); connect_conf *base = (connect_conf *) basev; connect_conf *overrides = (connect_conf *) overridesv; c->allowed_connect_ports = apr_array_append(p, base->allowed_connect_ports, overrides->allowed_connect_ports); return c; }
static void* line_edit_merge(apr_pool_t* pool, void* BASE, void* ADD) { line_edit_cfg* base = (line_edit_cfg*) BASE ; line_edit_cfg* add = (line_edit_cfg*) ADD ; line_edit_cfg* conf = apr_palloc(pool, sizeof(line_edit_cfg)) ; conf->lineend = (add->lineend == LINEEND_UNSET) ? base->lineend : add->lineend ; conf->rewriterules = apr_array_append(pool, base->rewriterules, add->rewriterules) ; conf->lechar = (add->lechar == 0) ? base->lechar : add->lechar; return conf ; }
static void *xsendfile_config_merge(apr_pool_t *p, void *basev, void *overridesv) { xsendfile_conf_t *base = (xsendfile_conf_t *)basev; xsendfile_conf_t *overrides = (xsendfile_conf_t *)overridesv; xsendfile_conf_t *conf; conf = (xsendfile_conf_t *) apr_pcalloc(p, sizeof(xsendfile_conf_t)); XSENDFILE_CFLAG(enabled); XSENDFILE_CFLAG(ignoreETag); XSENDFILE_CFLAG(ignoreLM); conf->paths = apr_array_append(p, overrides->paths, base->paths); return (void*)conf; }
static void *h2_config_merge(apr_pool_t *pool, void *basev, void *addv) { h2_config *base = (h2_config *)basev; h2_config *add = (h2_config *)addv; h2_config *n = (h2_config *)apr_pcalloc(pool, sizeof(h2_config)); char *name = apr_pstrcat(pool, "merged[", add->name, ", ", base->name, "]", NULL); n->name = name; n->h2_max_streams = H2_CONFIG_GET(add, base, h2_max_streams); n->h2_window_size = H2_CONFIG_GET(add, base, h2_window_size); n->min_workers = H2_CONFIG_GET(add, base, min_workers); n->max_workers = H2_CONFIG_GET(add, base, max_workers); n->max_worker_idle_secs = H2_CONFIG_GET(add, base, max_worker_idle_secs); n->stream_max_mem_size = H2_CONFIG_GET(add, base, stream_max_mem_size); n->alt_svcs = add->alt_svcs? add->alt_svcs : base->alt_svcs; n->alt_svc_max_age = H2_CONFIG_GET(add, base, alt_svc_max_age); n->serialize_headers = H2_CONFIG_GET(add, base, serialize_headers); n->h2_direct = H2_CONFIG_GET(add, base, h2_direct); n->modern_tls_only = H2_CONFIG_GET(add, base, modern_tls_only); n->h2_upgrade = H2_CONFIG_GET(add, base, h2_upgrade); n->tls_warmup_size = H2_CONFIG_GET(add, base, tls_warmup_size); n->tls_cooldown_secs = H2_CONFIG_GET(add, base, tls_cooldown_secs); n->h2_push = H2_CONFIG_GET(add, base, h2_push); if (add->priorities && base->priorities) { n->priorities = apr_hash_overlay(pool, add->priorities, base->priorities); } else { n->priorities = add->priorities? add->priorities : base->priorities; } n->push_diary_size = H2_CONFIG_GET(add, base, push_diary_size); n->copy_files = H2_CONFIG_GET(add, base, copy_files); if (add->push_list && base->push_list) { n->push_list = apr_array_append(pool, base->push_list, add->push_list); } else { n->push_list = add->push_list? add->push_list : base->push_list; } n->early_hints = H2_CONFIG_GET(add, base, early_hints); return n; }