You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2004/08/17 15:47:10 UTC

cvs commit: httpd-2.0/modules/mappers mod_so.h mod_so.c

jorton      2004/08/17 06:47:10

  Modified:    .        CHANGES
               server   config.c main.c
               include  http_config.h
               modules/mappers mod_so.h mod_so.c
  Log:
  Implement -t -DDUMP_MODULES using generic test_config hook rather than
  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
  
  Revision  Changes    Path
  1.1553    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1552
  retrieving revision 1.1553
  diff -d -w -u -r1.1552 -r1.1553
  --- CHANGES	15 Aug 2004 23:58:46 -0000	1.1552
  +++ CHANGES	17 Aug 2004 13:47:04 -0000	1.1553
  @@ -2,6 +2,9 @@
   
     [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>]
   
  
  
  
  1.181     +5 -0      httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.180
  retrieving revision 1.181
  diff -d -w -u -r1.180 -r1.181
  --- config.c	16 Jul 2004 20:30:43 -0000	1.180
  +++ config.c	17 Aug 2004 13:47:05 -0000	1.181
  @@ -72,6 +72,7 @@
              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,
  @@ -81,6 +82,10 @@
                             (apr_pool_t *pconf, apr_pool_t *plog,
                              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,
  
  
  
  1.162     +1 -9      httpd-2.0/server/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/main.c,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -d -w -u -r1.161 -r1.162
  --- main.c	12 Jul 2004 16:36:42 -0000	1.161
  +++ main.c	17 Aug 2004 13:47:06 -0000	1.162
  @@ -37,8 +37,6 @@
   #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.
    *
  @@ -609,18 +607,12 @@
       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);
           }
  
  
  
  1.112     +7 -0      httpd-2.0/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_config.h,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -d -w -u -r1.111 -r1.112
  --- http_config.h	14 Jul 2004 06:36:41 -0000	1.111
  +++ http_config.h	17 Aug 2004 13:47:09 -0000	1.112
  @@ -967,6 +967,13 @@
   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
  
  
  
  1.3       +0 -2      httpd-2.0/modules/mappers/mod_so.h
  
  Index: mod_so.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -d -w -u -r1.2 -r1.3
  --- mod_so.h	10 Jul 2004 03:38:02 -0000	1.2
  +++ mod_so.h	17 Aug 2004 13:47:10 -0000	1.3
  @@ -22,8 +22,6 @@
   /* 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 */
   
  
  
  
  1.60      +8 -3      httpd-2.0/modules/mappers/mod_so.c
  
  Index: mod_so.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -d -w -u -r1.59 -r1.60
  --- mod_so.c	12 Jul 2004 16:36:42 -0000	1.59
  +++ mod_so.c	17 Aug 2004 13:47:10 -0000	1.60
  @@ -92,7 +92,7 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "http_log.h"
  -#include "ap_config.h"
  +#include "http_core.h"
   
   #include "mod_so.h"
   
  @@ -347,13 +347,18 @@
       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");
  @@ -402,7 +407,7 @@
   {
   #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
   }