[svn:mod_parrot] r594 - mod_parrot/trunk/src
[email protected] Mon, 19 Jan 2009 10:09:27 -0800 (PST)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Mon Jan 19 10:09:27 2009
New Revision: 594
Modified:
mod_parrot/trunk/src/modparrot_config.c
Log:
fix various virtual host crashes and bad behavior.
NOTE: +Parent config crashes in the open_logs metahandler (segfault in
Parrot_find_method_with_cache). might be a parrot bug related to multiple
interpreters, but that's just a guess.
Modified: mod_parrot/trunk/src/modparrot_config.c
==============================================================================
--- mod_parrot/trunk/src/modparrot_config.c (original)
+++ mod_parrot/trunk/src/modparrot_config.c Mon Jan 19 10:09:27 2009
@@ -71,6 +71,7 @@
int i;
cfg = (modparrot_srv_config *)apr_pcalloc(p, sizeof(modparrot_srv_config));
+ cfg->ctx_pool = NULL;
cfg->pool = p;
cfg->trace_flags = -1; /* -1 == unspecified */
cfg->enable_option_flags = 0; /* only used during configuration merge */
@@ -108,14 +109,19 @@
cfg->so_path = NULL;
#endif /* (__FreeBSD__) */
- /* destroy context pool on cleanup */
- apr_pool_cleanup_register(p, s, modparrot_cleanup, apr_pool_cleanup_null);
+ /* if we will have our own pool, destroy context pool on cleanup */
+ if (!s->is_virtual ||
+ (s->is_virtual && (cfg->option_flags | MP_OPT_PARENT))) {
+ apr_pool_cleanup_register(p, s, modparrot_cleanup,
+ apr_pool_cleanup_null);
+ }
return (void *)cfg;
}
void *merge_modparrot_srv_config(apr_pool_t *p, void *base, void *new)
{
+ int i;
modparrot_srv_config *basecfg = (modparrot_srv_config *)base;
modparrot_srv_config *newcfg = (modparrot_srv_config *)new;
modparrot_srv_config *merged = (modparrot_srv_config *)
@@ -140,26 +146,34 @@
}
/* modules hash and array are only set in main server, so just copy */
- /* XXX need to enforce this
- newcfg->modules = apr_hash_copy(p, basecfg->modules);
- newcfg->module_array = apr_array_copy(p, basecfg->module_array);
+ /* XXX need to enforce this */
+ merged->module_hash = apr_hash_copy(p, basecfg->module_hash);
+ merged->module_array = apr_array_copy(p, basecfg->module_array);
+ for (i = 0; i < MP_HOOK_LAST; i++) {
+ merged->handler_modules[i] = basecfg->handler_modules[i] ?
+ apr_array_copy(p, basecfg->handler_modules[i]) : NULL;
+ }
+
+ /* inherit the init_path, since it's rare it will change for a vhost */
+ merged->init_path = newcfg->init_path ?
+ newcfg->init_path : basecfg->init_path;
/* merges specific to the Parent option */
if (newcfg->option_flags & MP_OPT_PARENT) {
+ merged->trace_flags = newcfg->trace_flags;
+ merged->preload = apr_array_copy(p, newcfg->preload);
+ merged->include_path = newcfg->include_path;
+ merged->lib_path = newcfg->lib_path;
+ merged->dynext_path = newcfg->dynext_path;
+ }
+ else {
+ /* just override the scalars */
merged->include_path = newcfg->include_path ?
newcfg->include_path : basecfg->include_path;
merged->lib_path = newcfg->lib_path ?
newcfg->lib_path : basecfg->lib_path;
merged->dynext_path = newcfg->dynext_path ?
newcfg->dynext_path : basecfg->dynext_path;
- merged->trace_flags = newcfg->trace_flags;
- merged->init_path = newcfg->init_path;
- merged->preload = apr_array_copy(p, newcfg->preload);
- }
- else {
- /* just override the scalars */
- merged->init_path = newcfg->init_path ?
- newcfg->init_path : basecfg->init_path;
merged->trace_flags = (newcfg->trace_flags != -1) ?
newcfg->trace_flags : basecfg->trace_flags;