From: Ryan Bloom Date: Thu, 30 Mar 2000 15:30:36 +0000 (+0000) Subject: Put the pre_config hook back into the table. This solves the problem of X-Git-Tag: APACHE_2_0_ALPHA_2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fa139e0508ecd813c97b0d26aca6d7c2b908628;p=thirdparty%2Fapache%2Fhttpd.git Put the pre_config hook back into the table. This solves the problem of the pre-config hook only being valid for MPM's. This patch also distinguishes between STANDARD modules and MPM's. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84862 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 009199e4962..5c7acc22822 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -231,9 +231,9 @@ #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 19990320 +#define MODULE_MAGIC_NUMBER_MAJOR 20000330 #endif -#define MODULE_MAGIC_NUMBER_MINOR 6 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */ /* Useful for testing for features. */ diff --git a/include/http_config.h b/include/http_config.h index ccc7e21d918..4cf661d7519 100644 --- a/include/http_config.h +++ b/include/http_config.h @@ -210,7 +210,7 @@ typedef struct module_struct { * It's mainly important for the DSO facility * (see also mod_so). */ - + void *(*pre_config) (ap_context_t *p, ap_context_t *plog, ap_context_t *ptemp, server_rec *s); void *(*create_dir_config) (ap_context_t *p, char *dir); void *(*merge_dir_config) (ap_context_t *p, void *base_conf, void *new_conf); void *(*create_server_config) (ap_context_t *p, server_rec *s); @@ -249,6 +249,15 @@ typedef struct module_struct { #define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ + MODULE_MAGIC_NUMBER_MINOR, \ + -1, \ + __FILE__, \ + NULL, \ + NULL, \ + MODULE_MAGIC_COOKIE, \ + NULL + +#define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ MODULE_MAGIC_NUMBER_MINOR, \ -1, \ __FILE__, \ @@ -368,7 +377,6 @@ CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, cons /* Hooks */ DECLARE_HOOK(int,header_parser,(request_rec *)) -DECLARE_HOOK(void,pre_config,(ap_context_t *pconf,ap_context_t *plog,ap_context_t *ptemp)) DECLARE_HOOK(void,post_config, (ap_context_t *pconf,ap_context_t *plog,ap_context_t *ptemp,server_rec *s)) DECLARE_HOOK(void,open_logs, diff --git a/server/config.c b/server/config.c index 4ea02c9f929..058f3d55cad 100644 --- a/server/config.c +++ b/server/config.c @@ -85,15 +85,12 @@ HOOK_STRUCT( HOOK_LINK(header_parser) - HOOK_LINK(pre_config) HOOK_LINK(post_config) HOOK_LINK(open_logs) HOOK_LINK(child_init) ) IMPLEMENT_HOOK_RUN_ALL(int,header_parser,(request_rec *r),(r),OK,DECLINED) -IMPLEMENT_HOOK_VOID(pre_config,(ap_context_t *pconf,ap_context_t *plog,ap_context_t *ptemp), - (pconf,plog,ptemp)) IMPLEMENT_HOOK_VOID(post_config, (ap_context_t *pconf, ap_context_t *plog, ap_context_t *ptemp, server_rec *s), (pconf,plog,ptemp,s)) @@ -1311,6 +1308,17 @@ void ap_single_module_configure(ap_context_t *p, server_rec *s, module *m) (*m->create_dir_config)(p, NULL)); } +void run_pre_config(ap_context_t *p, ap_context_t *plog, + ap_context_t *ptemp, server_rec *s) +{ + module *m; + + for (m = top_module; m; m = m->next) + if (m->pre_config) + (*m->pre_config) (p, plog, ptemp, s); + init_handlers(p); +} + void ap_post_config_hook(ap_context_t *pconf, ap_context_t *plog, ap_context_t *ptemp, server_rec *s) { ap_run_post_config(pconf,plog,ptemp,s); diff --git a/server/main.c b/server/main.c index d4e72e3b6a0..493a7c79c4d 100644 --- a/server/main.c +++ b/server/main.c @@ -275,10 +275,6 @@ static void usage(process_rec *process) destroy_and_exit_process(process, 1); } - - - - ap_context_t *g_pHookPool; #ifdef WIN32 @@ -368,7 +364,7 @@ API_EXPORT_NONSTD(int) main(int argc, char *argv[]) for example, to settle down. */ ap_server_root = def_server_root; - ap_run_pre_config(pconf, plog, ptemp); + run_pre_config(pconf, plog, ptemp, server_conf); server_conf = ap_read_config(process, ptemp, confname); if (configtestonly) { ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n"); @@ -387,7 +383,7 @@ API_EXPORT_NONSTD(int) main(int argc, char *argv[]) } ap_create_context(&ptemp, pconf); ap_server_root = def_server_root; - ap_run_pre_config(pconf, plog, ptemp); + run_pre_config(pconf, plog, ptemp, server_conf); server_conf = ap_read_config(process, ptemp, confname); ap_clear_pool(plog); ap_run_open_logs(pconf, plog, ptemp, server_conf); diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index 32c6d2837dc..a09f941004b 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -1498,7 +1498,6 @@ static void dexter_pre_config(ap_context_t *p, ap_context_t *plog, ap_context_t static void dexter_hooks(void) { - ap_hook_pre_config(dexter_pre_config, NULL, NULL, HOOK_MIDDLE); INIT_SIGLIST() one_process = 0; } @@ -1707,7 +1706,8 @@ LISTEN_COMMANDS }; module MODULE_VAR_EXPORT mpm_dexter_module = { - STANDARD20_MODULE_STUFF, + MPM20_MODULE_STUFF, + dexter_pre_config, /* run hook before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ NULL, /* create per-server config structure */ diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index c07b260bf0b..f6dfe92ab46 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -1212,7 +1212,6 @@ static void mpmt_beos_pre_config(ap_context_t *pconf, ap_context_t *plog, ap_con static void mpmt_beos_hooks(void) { - ap_hook_pre_config(mpmt_beos_pre_config,NULL,NULL,HOOK_MIDDLE); INIT_SIGLIST() one_process = 0; } @@ -1409,7 +1408,8 @@ LISTEN_COMMANDS }; module MODULE_VAR_EXPORT mpm_mpmt_beos_module = { - STANDARD20_MODULE_STUFF, + MPM20_MODULE_STUFF, + mpmt_beos_pre_config, /* hook run before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ NULL, /* create per-server config structure */ diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index d9fb9d4082d..2bc7326d87c 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1526,7 +1526,6 @@ static void mpmt_pthread_pre_config(ap_context_t *pconf, ap_context_t *plog, ap_ static void mpmt_pthread_hooks(void) { - ap_hook_pre_config(mpmt_pthread_pre_config,NULL,NULL,HOOK_MIDDLE); INIT_SIGLIST() one_process = 0; } @@ -1721,7 +1720,8 @@ LISTEN_COMMANDS }; module MODULE_VAR_EXPORT mpm_mpmt_pthread_module = { - STANDARD20_MODULE_STUFF, + MPM20_MODULE_STUFF, + mpmt_pthread_pre_config, /* run hook before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ NULL, /* create per-server config structure */ diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index c9f89868817..2522b469b1a 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -2407,7 +2407,6 @@ static void prefork_pre_config(ap_context_t *p, ap_context_t *plog, ap_context_t static void prefork_hooks(void) { - ap_hook_pre_config(prefork_pre_config,NULL,NULL,HOOK_MIDDLE); INIT_SIGLIST(); #ifdef AUX3 (void) set42sig(); @@ -2595,7 +2594,8 @@ LISTEN_COMMANDS }; module MODULE_VAR_EXPORT mpm_prefork_module = { - STANDARD20_MODULE_STUFF, + MPM20_MODULE_STUFF, + prefork_pre_config, /* run hook before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ NULL, /* create per-server config structure */ diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index 4869d0b3a65..bb144cec4c6 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -1632,7 +1632,6 @@ static void spmt_os2_pre_config(ap_context_t *pconf, ap_context_t *plog, ap_cont static void spmt_os2_hooks(void) { - ap_hook_pre_config(spmt_os2_pre_config,NULL,NULL,HOOK_MIDDLE); INIT_SIGLIST(); /* TODO: set one_process properly */ one_process = 0; } @@ -1784,7 +1783,8 @@ LISTEN_COMMANDS }; module MODULE_VAR_EXPORT mpm_spmt_os2_module = { - STANDARD20_MODULE_STUFF, + MPM20_MODULE_STUFF, + spmt_os2_pre_config, /* hook run before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ NULL, /* create per-server config structure */ diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 229352cc1fa..23f15c32641 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1747,7 +1747,6 @@ static void winnt_hooks(void) // INIT_SIGLIST() one_process = 0; /* Configuration hooks implemented by http_config.c ... */ - ap_hook_pre_config(winnt_pre_config, NULL, NULL, HOOK_MIDDLE); } /* @@ -1851,7 +1850,8 @@ LISTEN_COMMANDS }; module MODULE_VAR_EXPORT mpm_winnt_module = { - STANDARD20_MODULE_STUFF, + MPM20_MODULE_STUFF, + winnt_pre_config, /* hook run before configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ NULL, /* create per-server config structure */