hooking into mod_so from main.c:
* include/http_config.h, server/config.c: Declare test_config hook.
* server/main.c: Drop hooks into mod_so; run test_config hooks.
* modules/mappers/mod_so.h: Drop ap_dump_loaded_modules optional
function.
* modules/mappers/mod_so.c (dump_loaded_modules): Renamed from
ap_dump_loaded_modules; only run if -DDUMP_MODULES is defined.
(register_hooks): Register test_config hook instead of optional
function.
Reviewed by: Justin Erenkrantz, Paul Querna
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104685
13f79535-47bb-0310-9956-
ffa450edef68
[Remove entries to the current 2.0 section below, when backported]
+ *) Add test_config hook, run only if httpd is invoked using -t.
+ [Joe Orton]
+
*) WinNT MPM: Fix a broken log message at termination. PR 28063.
[Eider Oliveira <eider bol.com.br>]
AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,
apr_pool_t *ptemp))
+/**
+ * Run the test_config function for each module; this hook is run
+ * only if the server was invoked to test the configuration syntax.
+ * @param pconf The config pool
+ * @param s The list of server_recs
+ */
+AP_DECLARE_HOOK(void,test_config,(apr_pool_t *pconf, server_rec *s))
/**
* Run the post_config function for each module
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
-#include "ap_config.h"
+#include "http_core.h"
#include "mod_so.h"
return NULL;
}
-static void ap_dump_loaded_modules(apr_pool_t* p, server_rec* s)
+static void dump_loaded_modules(apr_pool_t *p, server_rec *s)
{
ap_module_symbol_t *modie;
ap_module_symbol_t *modi;
so_server_conf *sconf;
int i;
apr_file_t *out = NULL;
+
+ if (!ap_exists_config_define("DUMP_MODULES")) {
+ return;
+ }
+
apr_file_open_stderr(&out, p);
apr_file_printf(out, "Loaded Modules:\n");
{
#ifndef NO_DLOPEN
APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol);
- APR_REGISTER_OPTIONAL_FN(ap_dump_loaded_modules);
+ ap_hook_test_config(dump_loaded_modules, NULL, NULL, APR_HOOK_MIDDLE);
#endif
}
/* optional function declaration */
APR_DECLARE_OPTIONAL_FN(module *, ap_find_loaded_module_symbol,
(server_rec *s, const char *modname));
-APR_DECLARE_OPTIONAL_FN(void, ap_dump_loaded_modules,
- (apr_pool_t* p, server_rec *s));
#endif /* MOD_SO_H */
APR_HOOK_LINK(handler)
APR_HOOK_LINK(quick_handler)
APR_HOOK_LINK(optional_fn_retrieve)
+ APR_HOOK_LINK(test_config)
)
AP_IMPLEMENT_HOOK_RUN_ALL(int, header_parser,
apr_pool_t *ptemp),
(pconf, plog, ptemp), OK, DECLINED)
+AP_IMPLEMENT_HOOK_VOID(test_config,
+ (apr_pool_t *pconf, server_rec *s),
+ (pconf, s))
+
AP_IMPLEMENT_HOOK_RUN_ALL(int, post_config,
(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s),
#include "ap_mpm.h"
#include "mpm_common.h"
-#include "mod_so.h" /* for dumping loaded modules */
-
/* WARNING: Win32 binds http_main.c dynamically to the server. Please place
* extern functions and global data in another appropriate module.
*
rv = ap_process_config_tree(server_conf, ap_conftree,
process->pconf, ptemp);
if (rv == OK) {
- APR_OPTIONAL_FN_TYPE(ap_dump_loaded_modules) *dump_modules =
- APR_RETRIEVE_OPTIONAL_FN(ap_dump_loaded_modules);
-
ap_fixup_virtual_hosts(pconf, server_conf);
ap_fini_vhost_config(pconf, server_conf);
apr_hook_sort_all();
- if (dump_modules && ap_exists_config_define("DUMP_MODULES")) {
- dump_modules(pconf, server_conf);
- }
-
if (configtestonly) {
+ ap_run_test_config(pconf, server_conf);
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK");
destroy_and_exit_process(process, 0);
}