Commit aa5d0688 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

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
parent ce06aae2
Loading
Loading
Loading
Loading
+2 −2
Changes for include/ap_mmn.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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. */
+10 −2
Changes for include/http_config.h: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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,
+11 −3
Changes for server/config.c: 11 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -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); 
+2 −6
Changes for server/main.c: 2 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -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);
+2 −2
Changes for server/mpm/dexter/dexter.c: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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 */
Loading