From: William A. Rowe Jr Date: Sat, 27 May 2000 06:22:55 +0000 (+0000) Subject: Pass the process_rec to the MPM to allow rewriting of the args list. X-Git-Tag: APACHE_2_0_ALPHA_4~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e05af51e4271e4f057b9bcfb204d14ba535678f;p=apache Pass the process_rec to the MPM to allow rewriting of the args list. Especially necessary under Win32, or other non-unix front ends where oddball arguments might be required, but without causing a mess in http_main.c. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85311 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_config.h b/include/http_config.h index 810913a466..4b83080d70 100644 --- a/include/http_config.h +++ b/include/http_config.h @@ -224,6 +224,7 @@ typedef struct module_struct { * It's mainly important for the DSO facility * (see also mod_so). */ + void (*rewrite_args) (process_rec *process); void (*pre_config) (ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp); void *(*create_dir_config) (ap_pool_t *p, char *dir); void *(*merge_dir_config) (ap_pool_t *p, void *base_conf, void *new_conf); @@ -269,6 +270,7 @@ typedef struct module_struct { NULL, \ NULL, \ MODULE_MAGIC_COOKIE, \ + NULL, \ NULL #define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ @@ -382,6 +384,7 @@ void ap_show_modules(void); server_rec *ap_read_config(process_rec *process, ap_pool_t *temp_pool, const char *config_name); void ap_post_config_hook(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *s); void ap_child_init_hook(ap_pool_t *pchild, server_rec *s); +void ap_run_rewrite_args(process_rec *process); void ap_run_pre_config(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp); void ap_register_hooks(module *m); diff --git a/server/main.c b/server/main.c index d62f001f26..f6119492ea 100644 --- a/server/main.c +++ b/server/main.c @@ -67,14 +67,6 @@ #include "apr_getopt.h" #include "ap_mpm.h" -const char *ap_server_argv0; - -const char *ap_server_root; - -ap_array_header_t *ap_server_pre_read_config; -ap_array_header_t *ap_server_post_read_config; -ap_array_header_t *ap_server_config_defines; - /* XXX - We should be able to grab the per-MPM settings here too */ static void show_compile_settings(void) { @@ -280,8 +272,6 @@ static void usage(process_rec *process) destroy_and_exit_process(process, 1); } -ap_pool_t *g_pHookPool; - #ifdef WIN32 API_EXPORT(int) apache_main(int argc, char *argv[]) #else @@ -317,8 +307,6 @@ API_EXPORT(int) main(int argc, char *argv[]) ap_util_uri_init(); - g_pHookPool=pconf; - ap_setup_prelinked_modules(process); ap_create_pool(&pcommands, pglobal); @@ -326,7 +314,9 @@ API_EXPORT(int) main(int argc, char *argv[]) ap_server_post_read_config = ap_make_array(pcommands, 1, sizeof(char *)); ap_server_config_defines = ap_make_array(pcommands, 1, sizeof(char *)); - while (ap_getopt(argc, argv, "C:c:d:f:k:vVlLth", &c, pcommands) == APR_SUCCESS) { + ap_run_rewrite_args(process); + + while (ap_getopt(argc, argv, "C:c:D:d:f:vVlLth?", &c, pcommands) == APR_SUCCESS) { char **new; switch (c) { case 'c': @@ -340,6 +330,10 @@ API_EXPORT(int) main(int argc, char *argv[]) case 'd': def_server_root = ap_optarg; break; + case 'D': + new = (char **)ap_push_array(ap_server_config_defines); + *new = ap_pstrdup(pcommands, ap_optarg); + break; case 'f': confname = ap_optarg; break; @@ -359,9 +353,8 @@ API_EXPORT(int) main(int argc, char *argv[]) case 't': configtestonly = 1; break; - case 'h': - usage(process); case '?': + case 'h': usage(process); } } diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index 4eee463883..6b6a73cc19 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -1458,6 +1458,7 @@ LISTEN_COMMANDS module MODULE_EXPORT_VAR mpm_dexter_module = { MPM20_MODULE_STUFF, + NULL, /* hook to run before apache parses args */ dexter_pre_config, /* run hook before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index 879f38e32e..260b05958a 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -1261,6 +1261,7 @@ LISTEN_COMMANDS module MODULE_EXPORT_VAR mpm_mpmt_beos_module = { MPM20_MODULE_STUFF, + NULL, /* hook to run before apache parses args */ mpmt_beos_pre_config, /* hook run before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 4207e96974..7b9d557de4 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1477,6 +1477,7 @@ LISTEN_COMMANDS module MODULE_EXPORT_VAR mpm_mpmt_pthread_module = { MPM20_MODULE_STUFF, + NULL, /* hook to run before apache parses args */ mpmt_pthread_pre_config, /* run hook before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 755b10571f..e2e3033c82 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -2436,6 +2436,7 @@ LISTEN_COMMANDS module MODULE_EXPORT_VAR mpm_prefork_module = { MPM20_MODULE_STUFF, + NULL, /* hook to run before apache parses args */ prefork_pre_config, /* run hook before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index ea9061480c..f35616d5f0 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -1671,6 +1671,7 @@ LISTEN_COMMANDS module MODULE_EXPORT_VAR mpm_spmt_os2_module = { MPM20_MODULE_STUFF, + NULL, /* hook to run before apache parses args */ spmt_os2_pre_config, /* hook run before the configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 698a2db7f5..99c1202747 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1969,6 +1969,7 @@ LISTEN_COMMANDS module MODULE_EXPORT_VAR mpm_winnt_module = { MPM20_MODULE_STUFF, + NULL, /* hook run before arguments are parsed */ winnt_pre_config, /* hook run before configuration is read */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */