dougm 99/05/06 17:16:13
Modified: src CHANGES src/include ap_compat.h ap_mmn.h http_config.h http_core.h src/main http_config.c http_core.c Log: Fix configuration engine re-entrant hangups, which solve a handful of problems seen with mod_perl <Perl> configuration sections Submitted by: Salvador Ortiz Garcia <[EMAIL PROTECTED]> Reviewed by: Doug, Dean Revision Changes Path 1.1351 +4 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1350 retrieving revision 1.1351 diff -u -r1.1350 -r1.1351 --- CHANGES 1999/05/06 00:49:38 1.1350 +++ CHANGES 1999/05/07 00:16:06 1.1351 @@ -1,5 +1,9 @@ Changes with Apache 1.3.7 + *) Fix configuration engine re-entrant hangups, which solve a + handful of problems seen with mod_perl <Perl> configuration sections + [Salvador Ortiz Garcia <[EMAIL PROTECTED]>] + *) Mac OS and Mac OS X Server now use the appropriate custom layout by default when building with APACI; allow for platform-specific variable defaults in configure. [Wilfredo Sanchez] 1.17 +2 -0 apache-1.3/src/include/ap_compat.h Index: ap_compat.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/ap_compat.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ap_compat.h 1999/01/28 09:24:58 1.16 +++ ap_compat.h 1999/05/07 00:16:09 1.17 @@ -23,6 +23,7 @@ #define acquire_mutex ap_acquire_mutex #define add_cgi_vars ap_add_cgi_vars #define add_common_vars ap_add_common_vars +#define add_file_conf ap_add_file_conf #define add_module ap_add_module #define add_named_module ap_add_named_module #define add_per_dir_conf ap_add_per_dir_conf @@ -350,6 +351,7 @@ #define server_root_relative ap_server_root_relative #define set_byterange ap_set_byterange #define set_callback_and_alarm ap_set_callback_and_alarm +#define set_config_vectors ap_set_config_vectors #define set_content_length ap_set_content_length #define set_etag ap_set_etag #define set_file_slot ap_set_file_slot 1.34 +3 -1 apache-1.3/src/include/ap_mmn.h Index: ap_mmn.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/ap_mmn.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- ap_mmn.h 1999/04/20 17:51:37 1.33 +++ ap_mmn.h 1999/05/07 00:16:09 1.34 @@ -215,6 +215,8 @@ * 19990108.7 - ap_isxdigit added * 19990320 - METHODS and M_INVALID symbol values modified * 19990320.1 - add ap_vrprintf() + * 19990320.2 - add cmd_parms.context, ap_set_config_vectors, + * export ap_add_file_conf */ #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ @@ -222,7 +224,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320 #endif -#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */ #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */ /* Useful for testing for features. */ 1.102 +3 -0 apache-1.3/src/include/http_config.h Index: http_config.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/http_config.h,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- http_config.h 1999/03/10 10:34:08 1.101 +++ http_config.h 1999/05/07 00:16:10 1.102 @@ -170,6 +170,8 @@ */ const command_rec *cmd; /* configuration command */ const char *end_token; /* end token required to end a nested section */ + void *context; /* per_dir_config vector passed + * to handle_command */ } cmd_parms; /* This structure records the existence of handlers in a module... */ @@ -400,6 +402,7 @@ CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds); CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod); +CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod); CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l); #endif 1.57 +1 -0 apache-1.3/src/include/http_core.h Index: http_core.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/include/http_core.h,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- http_core.h 1999/04/28 08:35:08 1.56 +++ http_core.h 1999/05/07 00:16:10 1.57 @@ -293,6 +293,7 @@ /* for mod_perl */ CORE_EXPORT(void) ap_add_per_dir_conf (server_rec *s, void *dir_config); CORE_EXPORT(void) ap_add_per_url_conf (server_rec *s, void *url_config); +CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config); CORE_EXPORT_NONSTD(const char *) ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg); #endif 1.145 +22 -14 apache-1.3/src/main/http_config.c Index: http_config.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v retrieving revision 1.144 retrieving revision 1.145 diff -u -r1.144 -r1.145 --- http_config.c 1999/05/04 11:21:10 1.144 +++ http_config.c 1999/05/07 00:16:11 1.145 @@ -960,8 +960,26 @@ return NULL; } +CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod) +{ + void *mconfig = ap_get_module_config(config, mod); + void *sconfig = ap_get_module_config(parms->server->module_config, mod); + + if (!mconfig && mod->create_dir_config) { + mconfig = (*mod->create_dir_config) (parms->pool, parms->path); + ap_set_module_config(config, mod, mconfig); + } + + if (!sconfig && mod->create_server_config) { + sconfig = (*mod->create_server_config) (parms->pool, parms->server); + ap_set_module_config(parms->server->module_config, mod, sconfig); + } + return mconfig; +} + CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l) { + void *oldconfig; const char *args, *cmd_name, *retval; const command_rec *cmd; module *mod = top_module; @@ -974,6 +992,8 @@ if (*cmd_name == '\0') return NULL; + oldconfig = parms->context; + parms->context = config; do { if (!(cmd = ap_find_command_in_modules(cmd_name, &mod))) { errno = EINVAL; @@ -982,25 +1002,13 @@ "not included in the server configuration", NULL); } else { - void *mconfig = ap_get_module_config(config, mod); - void *sconfig = - ap_get_module_config(parms->server->module_config, mod); - - if (!mconfig && mod->create_dir_config) { - mconfig = (*mod->create_dir_config) (parms->pool, parms->path); - ap_set_module_config(config, mod, mconfig); - } - - if (!sconfig && mod->create_server_config) { - sconfig = - (*mod->create_server_config) (parms->pool, parms->server); - ap_set_module_config(parms->server->module_config, mod, sconfig); - } + void *mconfig = ap_set_config_vectors(parms,config, mod); retval = invoke_cmd(cmd, parms, mconfig, args); mod = mod->next; /* Next time around, skip this one */ } } while (retval && !strcmp(retval, DECLINE_CMD)); + parms->context = oldconfig; return retval; } 1.261 +2 -2 apache-1.3/src/main/http_core.c Index: http_core.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v retrieving revision 1.260 retrieving revision 1.261 diff -u -r1.260 -r1.261 --- http_core.c 1999/04/28 08:35:31 1.260 +++ http_core.c 1999/05/07 00:16:12 1.261 @@ -340,7 +340,7 @@ *new_space = url_config; } -static void add_file_conf(core_dir_config *conf, void *url_config) +CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config) { void **new_space = (void **)ap_push_array(conf->sec); @@ -1545,7 +1545,7 @@ conf->d_is_fnmatch = ap_is_fnmatch(conf->d) != 0; conf->r = r; - add_file_conf(c, new_file_conf); + ap_add_file_conf(c, new_file_conf); if (*arg != '\0') { return ap_pstrcat(cmd->pool, "Multiple ", thiscmd->name,