diff options
author | André Malo <nd@apache.org> | 2004-06-05 00:40:47 +0200 |
---|---|---|
committer | André Malo <nd@apache.org> | 2004-06-05 00:40:47 +0200 |
commit | 7accf16eed5269fd6085d1b5ccf4a2739b73b0cd (patch) | |
tree | 554b7daa186cbccc57a92e61a47522b0682626c0 | |
parent | ooooops. This file somehow got cleaned. (diff) | |
download | apache2-7accf16eed5269fd6085d1b5ccf4a2739b73b0cd.tar.xz apache2-7accf16eed5269fd6085d1b5ccf4a2739b73b0cd.zip |
Nobody objected:
<IfModule> now takes the module identifier in addition to the
filename.
CAUTION: this commit breaks the build on netware. It still needs
to be adjusted. (but I don't have any netware knowledge...)
Also, developers need to re-run buildconf on unices.
PR: 29003
Submitted by: Edward Rudd <eddie omegaware.com>, Andr� Malo
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103849 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | build/build-modules-c.awk | 12 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | include/ap_mmn.h | 3 | ||||
-rw-r--r-- | include/http_config.h | 13 | ||||
-rw-r--r-- | libhttpd.dsp | 29 | ||||
-rw-r--r-- | modules/mappers/mod_so.c | 46 | ||||
-rw-r--r-- | modules/mappers/mod_so.h | 27 | ||||
-rw-r--r-- | os/netware/modules.c | 25 | ||||
-rw-r--r-- | os/win32/modules.c | 9 | ||||
-rw-r--r-- | server/core.c | 24 |
11 files changed, 180 insertions, 13 deletions
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) <IfModule> now recognizes the module identifier in addition to the + file name. PR 29003. [Edward Rudd <eddie omegaware.com>, André Malo] + *) mod_ssl: Add "SSLUserName" directive to set r->user based on a chosen SSL environment variable. PR 20957. [Martin v. Loewis <martin v.loewis.de>] diff --git a/build/build-modules-c.awk b/build/build-modules-c.awk index 27ebbde1e6..fda31c2860 100644 --- a/build/build-modules-c.awk +++ b/build/build-modules-c.awk @@ -32,6 +32,7 @@ END { print "" print "#include \"ap_config.h\"" print "#include \"httpd.h\"" + print "#define CORE_PRIVATE" print "#include \"http_config.h\"" print "" for (i = 0; i < pn; ++i) { @@ -53,6 +54,17 @@ END { print "};" print "" print "/*" + print " * We need the symbols as strings for <IfModule> containers" + print " */" + print "" + print "ap_module_symbol_t ap_prelinked_module_symbols[] = {" + for (i = 0; i < n; ++i) { + printf (" {\"%s_module\", &%s_module},\n", modules[i], modules[i]) + } + print " {NULL, NULL}" + print "};" + print "" + print "/*" print " * Modules which initially form the" print " * list of available modules on startup," print " * i.e. these are the modules which are" diff --git a/configure.in b/configure.in index 68bc23bb0e..ee7a975bac 100644 --- a/configure.in +++ b/configure.in @@ -134,7 +134,7 @@ if test "$abs_builddir" != "$abs_srcdir"; then APR_ADDTO(INCLUDES, [-I\$(top_builddir)/include]) fi -APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_SUBDIR_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/filters -I\$(top_srcdir)/modules/proxy -I\$(top_srcdir)/include -I\$(top_srcdir)/modules/generators]) +APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_SUBDIR_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/filters -I\$(top_srcdir)/modules/proxy -I\$(top_srcdir)/include -I\$(top_srcdir)/modules/generators -I\$(top_srcdir)/modules/mappers]) echo $ac_n "${nl}Applying OS-specific hints for httpd ...${nl}" diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 3c94f4e411..d724fe7ef6 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -83,6 +83,7 @@ * 20040425 (2.1.0-dev) removed ap_add_named_module API * changed ap_add_module, ap_add_loaded_module, * ap_setup_prelinked_modules, ap_process_resource_config + * 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and ap_prelinked_module_symbols */ #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */ @@ -90,7 +91,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20040425 #endif -#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/http_config.h b/include/http_config.h index b0cda63042..31b6dd6502 100644 --- a/include/http_config.h +++ b/include/http_config.h @@ -705,6 +705,14 @@ AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd, #ifdef CORE_PRIVATE /** + * This structure is used to assign symbol names to module pointers + */ +typedef struct { + const char *name; + module *modp; +} ap_module_symbol_t; + +/** * The topmost module in the list * @defvar module *ap_top_module */ @@ -716,6 +724,11 @@ AP_DECLARE_DATA extern module *ap_top_module; */ AP_DECLARE_DATA extern module *ap_prelinked_modules[]; /** + * Array of all statically linked modulenames (symbols) + * @defvar ap_module_symbol_t ap_prelinked_modulenames[] + */ +AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[]; +/** * Array of all preloaded modules * @defvar module *ap_preloaded_modules[] */ diff --git a/libhttpd.dsp b/libhttpd.dsp index cc21ffa22d..4def46c08e 100644 --- a/libhttpd.dsp +++ b/libhttpd.dsp @@ -241,6 +241,35 @@ InputPath=.\modules\dav\main\mod_dav.h # End Source File # Begin Source File +SOURCE=.\modules\mappers\mod_so.h + +!IF "$(CFG)" == "libhttpd - Win32 Release" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Creating include/mod_so.h +InputPath=.\modules\mappers\mod_so.h + +".\include\mod_so.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\modules\mappers\mod_so.h > .\include\mod_so.h + +# End Custom Build + +!ELSEIF "$(CFG)" == "libhttpd - Win32 Debug" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Creating include/mod_so.h +InputPath=.\modules\mappers\mod_so.h + +".\include\mod_so.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\modules\mappers\mod_so.h > .\include\mod_so.h + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=.\modules\filters\mod_include.h !IF "$(CFG)" == "libhttpd - Win32 Release" diff --git a/modules/mappers/mod_so.c b/modules/mappers/mod_so.c index 578b170a05..9088d7f9ff 100644 --- a/modules/mappers/mod_so.c +++ b/modules/mappers/mod_so.c @@ -94,6 +94,8 @@ #include "http_log.h" #include "ap_config.h" +#include "mod_so.h" + module AP_MODULE_DECLARE_DATA so_module; @@ -102,11 +104,6 @@ module AP_MODULE_DECLARE_DATA so_module; * loaded modules and the corresponding module name. */ -typedef struct moduleinfo { - const char *name; - module *modp; -} moduleinfo; - typedef struct so_server_conf { apr_array_header_t *loaded_modules; } so_server_conf; @@ -117,7 +114,7 @@ static void *so_sconf_create(apr_pool_t *p, server_rec *s) soc = (so_server_conf *)apr_pcalloc(p, sizeof(so_server_conf)); soc->loaded_modules = apr_array_make(p, DYNAMIC_MODULE_LIMIT, - sizeof(moduleinfo)); + sizeof(ap_module_symbol_t)); return (void *)soc; } @@ -131,7 +128,7 @@ static void *so_sconf_create(apr_pool_t *p, server_rec *s) static apr_status_t unload_module(void *data) { - moduleinfo *modi = (moduleinfo*)data; + ap_module_symbol_t *modi = (ap_module_symbol_t*)data; /* only unload if module information is still existing */ if (modi->modp == NULL) @@ -159,8 +156,8 @@ static const char *load_module(cmd_parms *cmd, void *dummy, module *modp; const char *szModuleFile = ap_server_root_relative(cmd->pool, filename); so_server_conf *sconf; - moduleinfo *modi; - moduleinfo *modie; + ap_module_symbol_t *modi; + ap_module_symbol_t *modie; int i; const char *error; @@ -182,7 +179,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy, */ sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config, &so_module); - modie = (moduleinfo *)sconf->loaded_modules->elts; + 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 && strcmp(modi->name, modname) == 0) { @@ -330,6 +327,26 @@ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename) return NULL; } +static module *ap_find_loaded_module_symbol(server_rec *s, const char *modname) +{ + so_server_conf *sconf; + ap_module_symbol_t *modi; + ap_module_symbol_t *modie; + int i; + + sconf = (so_server_conf *)ap_get_module_config(s->module_config, + &so_module); + 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 && strcmp(modi->name, modname) == 0) { + return modi->modp; + } + } + return NULL; +} + #else /* not NO_DLOPEN */ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename) @@ -349,6 +366,13 @@ static const char *load_module(cmd_parms *cmd, void *dummy, #endif /* NO_DLOPEN */ +static void register_hooks(apr_pool_t *p) +{ +#ifndef NO_DLOPEN + APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol); +#endif +} + static const command_rec so_cmds[] = { AP_INIT_TAKE2("LoadModule", load_module, NULL, RSRC_CONF | EXEC_ON_READ, "a module name and the name of a shared object file to load it from"), @@ -364,5 +388,5 @@ module AP_MODULE_DECLARE_DATA so_module = { so_sconf_create, /* server config */ NULL, /* merge server config */ so_cmds, /* command apr_table_t */ - NULL /* register hooks */ + register_hooks /* register hooks */ }; diff --git a/modules/mappers/mod_so.h b/modules/mappers/mod_so.h new file mode 100644 index 0000000000..514ba6c932 --- /dev/null +++ b/modules/mappers/mod_so.h @@ -0,0 +1,27 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MOD_SO_H +#define MOD_SO_H 1 + +#include "apr_optional.h" +#include "httpd.h" + +/* optional function declaration */ +APR_DECLARE_OPTIONAL_FN(module *, ap_find_loaded_module_symbol, + (server_rec *s, const char *modname)); + +#endif /* MOD_SO_H */ + diff --git a/os/netware/modules.c b/os/netware/modules.c index 7d3b791738..0115cc8f4e 100644 --- a/os/netware/modules.c +++ b/os/netware/modules.c @@ -69,6 +69,31 @@ module *ap_prelinked_modules[] = { NULL }; +ap_module_symbol_t ap_prelinked_module_symbols[] = { + {"core_module", &core_module}, + {"mpm_netware_module", &mpm_netware_module}, + {"http_module", &http_module}, + {"so_module", &so_module}, + {"mime_module", &mime_module}, + {"authz_host_module", &authz_host_module}, + {"negotiation_module", &negotiation_module}, + {"include_module", &include_module}, + {"autoindex_module", &autoindex_module}, + {"dir_module", &dir_module}, + {"cgi_module", &cgi_module}, + {"userdir_module", &userdir_module}, + {"alias_module", &alias_module}, + {"env_module", &env_module}, + {"log_config_module", &log_config_module}, + {"asis_module", &asis_module}, + {"imap_module", &imap_module}, + {"actions_module", &actions_module}, + {"setenvif_module", &setenvif_module}, + {"nwssl_module", &nwssl_module}, + {"netware_module", &netware_module}, + {NULL, NULL} +}; + module *ap_preloaded_modules[] = { &core_module, &mpm_netware_module, diff --git a/os/win32/modules.c b/os/win32/modules.c index 49cb856c6f..447f9cd886 100644 --- a/os/win32/modules.c +++ b/os/win32/modules.c @@ -37,6 +37,15 @@ AP_DECLARE_DATA module *ap_prelinked_modules[] = { NULL }; +ap_module_symbol_t ap_prelinked_module_symbols[] = { + {"core_module", &core_module}, + {"win32_module", &win32_module}, + {"mpm_winnt_module", &mpm_winnt_module}, + {"http_module", &http_module}, + {"so_module", &so_module}, + {NULL, NULL} +}; + AP_DECLARE_DATA module *ap_preloaded_modules[] = { &core_module, &win32_module, diff --git a/server/core.c b/server/core.c index 3475c0f347..35eb37efb5 100644 --- a/server/core.c +++ b/server/core.c @@ -48,6 +48,8 @@ #include "mod_proxy.h" #include "ap_listen.h" +#include "mod_so.h" /* for ap_find_loaded_module_symbol */ + /* LimitRequestBody handling */ #define AP_LIMIT_REQ_BODY_UNSET ((apr_off_t) -1) #define AP_DEFAULT_LIMIT_REQ_BODY ((apr_off_t) 0) @@ -1896,6 +1898,28 @@ static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg) found = ap_find_linked_module(arg); + /* search prelinked stuff */ + if (!found) { + ap_module_symbol_t *current = ap_prelinked_module_symbols; + + for (; current->name; ++current) { + if (!strcmp(current->name, arg)) { + found = current->modp; + break; + } + } + } + + /* search dynamic stuff */ + if (!found) { + APR_OPTIONAL_FN_TYPE(ap_find_loaded_module_symbol) *check_symbol = + APR_RETRIEVE_OPTIONAL_FN(ap_find_loaded_module_symbol); + + if (check_symbol) { + found = check_symbol(cmd->server, arg); + } + } + if ((!not && found) || (not && !found)) { ap_directive_t *parent = NULL; ap_directive_t *current = NULL; |