mirror of
https://github.com/apache/httpd.git
synced 2025-11-08 04:22:21 +03:00
Add DUMP_MODULES
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104213 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -2,6 +2,11 @@ Changes with Apache 2.1.0-dev
|
|||||||
|
|
||||||
[Remove entries to the current 2.0 section below, when backported]
|
[Remove entries to the current 2.0 section below, when backported]
|
||||||
|
|
||||||
|
*) mod_so, core: Add new command line options to print all loaded
|
||||||
|
modules. '-t -D DUMP_MODULES' and '-M' will show all static
|
||||||
|
and shared modules as loaded from the configuration file.
|
||||||
|
[Paul Querna]
|
||||||
|
|
||||||
*) mod_autoindex: Add ShowForbidden to IndexOptions to list files
|
*) mod_autoindex: Add ShowForbidden to IndexOptions to list files
|
||||||
that are not shown because the subrequest returned 401 or 403.
|
that are not shown because the subrequest returned 401 or 403.
|
||||||
PR 10575. [Paul Querna]
|
PR 10575. [Paul Querna]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8' ?>
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
|
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
|
||||||
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
|
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
|
||||||
<!-- $Revision: 1.10 $ -->
|
<!-- $Revision: 1.11 $ -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright 2002-2004 The Apache Software Foundation
|
Copyright 2002-2004 The Apache Software Foundation
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
[ -<strong>R</strong> <var>directory</var> ] [ -<strong>h</strong> ]
|
[ -<strong>R</strong> <var>directory</var> ] [ -<strong>h</strong> ]
|
||||||
[ -<strong>l</strong> ] [ -<strong>L</strong> ] [ -<strong>S</strong> ]
|
[ -<strong>l</strong> ] [ -<strong>L</strong> ] [ -<strong>S</strong> ]
|
||||||
[ -<strong>t</strong> ] [ -<strong>v</strong> ] [ -<strong>V</strong> ]
|
[ -<strong>t</strong> ] [ -<strong>v</strong> ] [ -<strong>V</strong> ]
|
||||||
[ -<strong>X</strong> ]</code></p>
|
[ -<strong>X</strong> ] [ -<strong>M</strong> ]</code></p>
|
||||||
|
|
||||||
<p>On <a href="../platform/windows.html">Windows systems</a>, the
|
<p>On <a href="../platform/windows.html">Windows systems</a>, the
|
||||||
following additional arguments are available:</p>
|
following additional arguments are available:</p>
|
||||||
@@ -138,6 +138,10 @@ the <directive module="mod_so">LoadModule</directive> directive.</dd>
|
|||||||
<dd>Output a list of directives together with expected arguments and
|
<dd>Output a list of directives together with expected arguments and
|
||||||
places where the directive is valid.</dd>
|
places where the directive is valid.</dd>
|
||||||
|
|
||||||
|
<dt><code>-M</code></dt>
|
||||||
|
|
||||||
|
<dd>Dump a list of loaded Static and Shared Modules.</dd>
|
||||||
|
|
||||||
<dt><code>-S</code></dt>
|
<dt><code>-S</code></dt>
|
||||||
|
|
||||||
<dd>Show the settings as parsed from the config file (currently only
|
<dd>Show the settings as parsed from the config file (currently only
|
||||||
@@ -149,7 +153,8 @@ shows the virtualhost settings).</dd>
|
|||||||
immediately exits after these syntax parsing tests with either a return code
|
immediately exits after these syntax parsing tests with either a return code
|
||||||
of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D
|
of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D
|
||||||
<var>DUMP</var>_<var>VHOSTS </var>is also set, details of the virtual host
|
<var>DUMP</var>_<var>VHOSTS </var>is also set, details of the virtual host
|
||||||
configuration will be printed.</dd>
|
configuration will be printed. If -D <var>DUMP</var>_<var>MODULES </var> is
|
||||||
|
set, all loaded modules will be printed.</dd>
|
||||||
|
|
||||||
<dt><code>-v</code></dt>
|
<dt><code>-v</code></dt>
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
* in apr_getopt() format. Use this for default'ing args that the MPM
|
* in apr_getopt() format. Use this for default'ing args that the MPM
|
||||||
* can safely ignore and pass on from its rewrite_args() handler.
|
* can safely ignore and pass on from its rewrite_args() handler.
|
||||||
*/
|
*/
|
||||||
#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtSh?X"
|
#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtSMh?X"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -347,6 +347,39 @@ static module *ap_find_loaded_module_symbol(server_rec *s, const char *modname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ap_dump_loaded_modules(apr_pool_t* p, server_rec* s)
|
||||||
|
{
|
||||||
|
ap_module_symbol_t *modie;
|
||||||
|
ap_module_symbol_t *modi;
|
||||||
|
so_server_conf *sconf;
|
||||||
|
module *modp;
|
||||||
|
int i;
|
||||||
|
apr_file_t *out = NULL;
|
||||||
|
apr_file_open_stderr(&out, p);
|
||||||
|
|
||||||
|
apr_file_printf(out, "Loaded Modules:\n");
|
||||||
|
|
||||||
|
sconf = (so_server_conf *)ap_get_module_config(s->module_config,
|
||||||
|
&so_module);
|
||||||
|
for (i = 0; ; i++) {
|
||||||
|
modi = &ap_prelinked_module_symbols[i];
|
||||||
|
if (modi->name != NULL) {
|
||||||
|
apr_file_printf(out, " %s (static)\n", modi->name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
|
||||||
|
for (i = 0; i < sconf->loaded_modules->nelts; i++) {
|
||||||
|
modi = &modie[i];
|
||||||
|
if (modi->name != NULL) {
|
||||||
|
apr_file_printf(out, " %s (shared)\n", modi->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else /* not NO_DLOPEN */
|
#else /* not NO_DLOPEN */
|
||||||
|
|
||||||
static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
|
static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
|
||||||
@@ -370,6 +403,7 @@ static void register_hooks(apr_pool_t *p)
|
|||||||
{
|
{
|
||||||
#ifndef NO_DLOPEN
|
#ifndef NO_DLOPEN
|
||||||
APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol);
|
APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol);
|
||||||
|
APR_REGISTER_OPTIONAL_FN(ap_dump_loaded_modules);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
/* optional function declaration */
|
/* optional function declaration */
|
||||||
APR_DECLARE_OPTIONAL_FN(module *, ap_find_loaded_module_symbol,
|
APR_DECLARE_OPTIONAL_FN(module *, ap_find_loaded_module_symbol,
|
||||||
(server_rec *s, const char *modname));
|
(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 */
|
#endif /* MOD_SO_H */
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include "ap_mpm.h"
|
#include "ap_mpm.h"
|
||||||
#include "mpm_common.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
|
/* WARNING: Win32 binds http_main.c dynamically to the server. Please place
|
||||||
* extern functions and global data in another appropriate module.
|
* extern functions and global data in another appropriate module.
|
||||||
*
|
*
|
||||||
@@ -394,6 +396,10 @@ static void usage(process_rec *process)
|
|||||||
"vhost settings)");
|
"vhost settings)");
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
" -S : a synonym for -t -D DUMP_VHOSTS");
|
" -S : a synonym for -t -D DUMP_VHOSTS");
|
||||||
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
|
" -t -D DUMP_MODULES : show all loaded modules ");
|
||||||
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
|
" -M : a synonym for -t -D DUMP_MODULES");
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
" -t : run syntax check for config files");
|
" -t : run syntax check for config files");
|
||||||
|
|
||||||
@@ -481,6 +487,9 @@ int main(int argc, const char * const argv[])
|
|||||||
/* Setting -D DUMP_VHOSTS is equivalent to setting -S */
|
/* Setting -D DUMP_VHOSTS is equivalent to setting -S */
|
||||||
if (strcmp(optarg, "DUMP_VHOSTS") == 0)
|
if (strcmp(optarg, "DUMP_VHOSTS") == 0)
|
||||||
configtestonly = 1;
|
configtestonly = 1;
|
||||||
|
/* Setting -D DUMP_MODULES is equivalent to setting -M */
|
||||||
|
if (strcmp(optarg, "DUMP_MODULES") == 0)
|
||||||
|
configtestonly = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
@@ -553,6 +562,12 @@ int main(int argc, const char * const argv[])
|
|||||||
*new = "DUMP_VHOSTS";
|
*new = "DUMP_VHOSTS";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
configtestonly = 1;
|
||||||
|
new = (char **)apr_array_push(ap_server_config_defines);
|
||||||
|
*new = "DUMP_MODULES";
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
usage(process);
|
usage(process);
|
||||||
@@ -593,9 +608,17 @@ int main(int argc, const char * const argv[])
|
|||||||
rv = ap_process_config_tree(server_conf, ap_conftree,
|
rv = ap_process_config_tree(server_conf, ap_conftree,
|
||||||
process->pconf, ptemp);
|
process->pconf, ptemp);
|
||||||
if (rv == OK) {
|
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_fixup_virtual_hosts(pconf, server_conf);
|
||||||
ap_fini_vhost_config(pconf, server_conf);
|
ap_fini_vhost_config(pconf, server_conf);
|
||||||
apr_hook_sort_all();
|
apr_hook_sort_all();
|
||||||
|
|
||||||
|
if (dump_modules && ap_exists_config_define("DUMP_MODULES")) {
|
||||||
|
dump_modules(pconf, server_conf);
|
||||||
|
}
|
||||||
|
|
||||||
if (configtestonly) {
|
if (configtestonly) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK");
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK");
|
||||||
destroy_and_exit_process(process, 0);
|
destroy_and_exit_process(process, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user