httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject cvs commit: httpd-2.0/modules/generators mod_info.c
Date Sun, 05 Sep 2004 05:48:32 GMT
pquerna     2004/09/04 22:48:32

  Modified:    .        CHANGES
               docs/manual/mod mod_info.html.en mod_info.xml
               modules/generators mod_info.c
  Log:
  mod_info: Added ?hooks. Now outputs XHTML. Added more build info.
  updated mod_info docs.
  
  Revision  Changes    Path
  1.1586    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1585
  retrieving revision 1.1586
  diff -u -r1.1585 -r1.1586
  --- CHANGES	4 Sep 2004 11:43:34 -0000	1.1585
  +++ CHANGES	5 Sep 2004 05:48:31 -0000	1.1586
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) mod_info: Added listing of the Request Hooks and added more build 
  +     information like 'httpd -V' contains. Changed output to XHTML. 
  +     [Paul Querna]
  +
     *) mod_info: Rewrote config tree walk using a recursive function.
        Added ?config option. Added printout of config filename and line numbers.
        [Rici Lake <rici ricilake.net>, Paul Querna]
  
  
  
  1.31      +2 -0      httpd-2.0/docs/manual/mod/mod_info.html.en
  
  Index: mod_info.html.en
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_info.html.en,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- mod_info.html.en	4 Sep 2004 08:47:19 -0000	1.30
  +++ mod_info.html.en	5 Sep 2004 05:48:32 -0000	1.31
  @@ -104,6 +104,8 @@
               <dd>Only information relevant to the named module</dd>
           <dt><code>?config</code></dt>
               <dd>Just the configuration directives, not sorted by module</dd>
  +        <dt><code>?hooks</code></dt>
  +            <dd>Only the list of Hooks each module is attached to</dd>
           <dt><code>?list</code></dt>
               <dd>Only a simple list of enabled modules</dd>
           <dt><code>?server</code></dt>
  
  
  
  1.20      +3 -1      httpd-2.0/docs/manual/mod/mod_info.xml
  
  Index: mod_info.xml
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_info.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_info.xml	5 Sep 2004 04:16:33 -0000	1.19
  +++ mod_info.xml	5 Sep 2004 05:48:32 -0000	1.20
  @@ -91,6 +91,8 @@
               <dd>Only information relevant to the named module</dd>
           <dt><code>?config</code></dt>
               <dd>Just the configuration directives, not sorted by module</dd>
  +        <dt><code>?hooks</code></dt>
  +            <dd>Only the list of Hooks each module is attached to</dd>
           <dt><code>?list</code></dt>
               <dd>Only a simple list of enabled modules</dd>
           <dt><code>?server</code></dt>
  
  
  
  1.60      +284 -80   httpd-2.0/modules/generators/mod_info.c
  
  Index: mod_info.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_info.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- mod_info.c	5 Sep 2004 02:11:16 -0000	1.59
  +++ mod_info.c	5 Sep 2004 05:48:32 -0000	1.60
  @@ -26,6 +26,7 @@
    * GET /server-info?module_name - Returns configuration for a single module
    * GET /server-info?list - Returns quick list of included modules
    * GET /server-info?config - Returns full configuration
  + * GET /server-info?hooks - Returns a listing of the modules active for each hook
    *
    * Original Author: 
    *   Rasmus Lerdorf <rasmus vex.net>, May 1996
  @@ -38,6 +39,13 @@
    * 
    */
   
  +
  +#include "apr.h"
  +#include "apr_strings.h"
  +#include "apr_lib.h"
  +#define APR_WANT_STRFUNC
  +#include "apr_want.h"
  +
   #define CORE_PRIVATE
   
   #include "httpd.h"
  @@ -48,10 +56,6 @@
   #include "http_protocol.h"
   #include "http_request.h"
   #include "util_script.h"
  -#include "apr_strings.h"
  -#include "apr_lib.h"
  -#define APR_WANT_STRFUNC
  -#include "apr_want.h"
   #include "ap_mpm.h"
   
   typedef struct
  @@ -110,7 +114,8 @@
           thisfn = ap_escape_html(r->pool, thisfn);
           ap_rprintf(r, "<dd><tt><strong>In file: %s</strong></tt></dd>\n",
                      thisfn);
  -        ap_set_module_config(r->request_config, &info_module, thisfn);
  +        ap_set_module_config(r->request_config, &info_module,
  +                             (void *) thisfn);
       }
   
       ap_rputs("<dd><tt>", r);
  @@ -227,6 +232,7 @@
       hook_get_t get;
   } hook_lookup_t;
   
  +/* TODO: Find Any Missing Hooks */
   static hook_lookup_t request_hooks[] = {
       {"Post-Read Request", ap_hook_get_post_read_request},
       {"Header Parse", ap_hook_get_header_parser},
  @@ -310,15 +316,255 @@
       return 0;
   }
   
  +static int show_server_settings(request_rec *r)
  +{
  +    server_rec *serv = r->server;
  +    int max_daemons, forked, threaded;
  +
  +    ap_rputs("<a name=\"server\"<h2>Server Settings</h2></a>", r);
  +    ap_rprintf(r,
  +               "<dl><dt><strong>Server Version:</strong> "
  +               "<font size=\"+1\"><tt>%s</tt></font></dt>\n",
  +               ap_get_server_version());
  +    ap_rprintf(r,
  +               "<dt><strong>Server Built:</strong> "
  +               "<font size=\"+1\"><tt>%s</tt></font></dt>\n",
  +               ap_get_server_built());
  +    ap_rprintf(r,
  +               "<dt><strong>Module Magic Number:</strong> "
  +               "<tt>%d:%d</tt></dt>\n", MODULE_MAGIC_NUMBER_MAJOR,
  +               MODULE_MAGIC_NUMBER_MINOR);
  +    ap_rprintf(r,
  +               "<dt><strong>Hostname/port:</strong> "
  +               "<tt>%s:%u</tt></dt>\n", ap_get_server_name(r),
  +               ap_get_server_port(r));
  +    ap_rprintf(r,
  +               "<dt><strong>Timeouts:</strong> "
  +               "<tt>connection: %d &nbsp;&nbsp; "
  +               "keep-alive: %d</tt></dt>",
  +               (int) (apr_time_sec(serv->timeout)),
  +               (int) (apr_time_sec(serv->timeout)));
  +    ap_mpm_query(AP_MPMQ_MAX_DAEMON_USED, &max_daemons);
  +    ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded);
  +    ap_mpm_query(AP_MPMQ_IS_FORKED, &forked);
  +    ap_rprintf(r, "<dt><strong>MPM Name:</strong> <tt>%s</tt></dt>\n",
  +               ap_show_mpm());
  +    ap_rprintf(r,
  +               "<dt><strong>MPM Information:</strong> "
  +               "<tt>Max Daemons: %d Threaded: %s Forked: %s</tt></dt>\n",
  +               max_daemons, threaded ? "yes" : "no", forked ? "yes" : "no");
  +    ap_rprintf(r,
  +               "<dt><strong>Server Architecture:</strong> "
  +               "<tt>%ld-bit</tt></dt>\n", 8 * (long) sizeof(void *));
  +    ap_rprintf(r,
  +               "<dt><strong>Server Root:</strong> "
  +               "<tt>%s</tt></dt>\n", ap_server_root);
  +    ap_rprintf(r,
  +               "<dt><strong>Config File:</strong> "
  +               "<tt>%s</tt></dt>\n", ap_conftree->filename);
  +
  +    ap_rputs("<dt><strong>Server Built With:</strong>\n<tt>\n<pre>",
r);
  +
  +    /* TODO: Not all of these are getting set like they do in main.c. 
  +     *       Missing some headers? 
  +     */
  +
  +#ifdef BIG_SECURITY_HOLE
  +    ap_rputs(" -D BIG_SECURITY_HOLE\n", r);
  +#endif
  +
  +#ifdef SECURITY_HOLE_PASS_AUTHORIZATION
  +    ap_rputs(" -D SECURITY_HOLE_PASS_AUTHORIZATION\n", r);
  +#endif
  +
  +#ifdef OS
  +    ap_rputs(" -D OS=\"" OS "\"\n", r);
  +#endif
  +
  +#ifdef APACHE_MPM_DIR
  +    ap_rputs(" -D APACHE_MPM_DIR=\"" APACHE_MPM_DIR "\"\n", r);
  +#endif
  +
  +#ifdef HAVE_SHMGET
  +    ap_rputs(" -D HAVE_SHMGET\n", r);
  +#endif
  +
  +#if APR_FILE_BASED_SHM
  +    ap_rputs(" -D APR_FILE_BASED_SHM\n", r);
  +#endif
  +
  +#if APR_HAS_SENDFILE
  +    ap_rputs(" -D APR_HAS_SENDFILE\n", r);
  +#endif
  +
  +#if APR_HAS_MMAP
  +    ap_rputs(" -D APR_HAS_MMAP\n", r);
  +#endif
  +
  +#ifdef NO_WRITEV
  +    ap_rputs(" -D NO_WRITEV\n", r);
  +#endif
  +
  +#ifdef NO_LINGCLOSE
  +    ap_rputs(" -D NO_LINGCLOSE\n", r);
  +#endif
  +
  +#if APR_HAVE_IPV6
  +    ap_rputs(" -D APR_HAVE_IPV6 (IPv4-mapped addresses ", r);
  +#ifdef AP_ENABLE_V4_MAPPED
  +    ap_rputs("enabled)\n", r);
  +#else
  +    ap_rputs("disabled)\n", r);
  +#endif
  +#endif
  +
  +#if APR_USE_FLOCK_SERIALIZE
  +    ap_rputs(" -D APR_USE_FLOCK_SERIALIZE\n", r);
  +#endif
  +
  +#if APR_USE_SYSVSEM_SERIALIZE
  +    ap_rputs(" -D APR_USE_SYSVSEM_SERIALIZE\n", r);
  +#endif
  +
  +#if APR_USE_POSIXSEM_SERIALIZE
  +    ap_rputs(" -D APR_USE_POSIXSEM_SERIALIZE\n", r);
  +#endif
  +
  +#if APR_USE_FCNTL_SERIALIZE
  +    ap_rputs(" -D APR_USE_FCNTL_SERIALIZE\n", r);
  +#endif
  +
  +#if APR_USE_PROC_PTHREAD_SERIALIZE
  +    ap_rputs(" -D APR_USE_PROC_PTHREAD_SERIALIZE\n", r);
  +#endif
  +#if APR_PROCESS_LOCK_IS_GLOBAL
  +    ap_rputs(" -D APR_PROCESS_LOCK_IS_GLOBAL\n", r);
  +#endif
  +
  +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  +    ap_rputs(" -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT\n", r);
  +#endif
  +
  +#if APR_HAS_OTHER_CHILD
  +    ap_rputs(" -D APR_HAS_OTHER_CHILD\n", r);
  +#endif
  +
  +#ifdef AP_HAVE_RELIABLE_PIPED_LOGS
  +    ap_rputs(" -D AP_HAVE_RELIABLE_PIPED_LOGS\n", r);
  +#endif
  +
  +#ifdef BUFFERED_LOGS
  +    ap_rputs(" -D BUFFERED_LOGS\n", r);
  +#ifdef PIPE_BUF
  +    ap_rputs(" -D PIPE_BUF=%ld\n", (long) PIPE_BUF, r);
  +#endif
  +#endif
  +
  +#if APR_CHARSET_EBCDIC
  +    ap_rputs(" -D APR_CHARSET_EBCDIC\n", r);
  +#endif
  +
  +#ifdef NEED_HASHBANG_EMUL
  +    ap_rputs(" -D NEED_HASHBANG_EMUL\n", r);
  +#endif
  +
  +#ifdef SHARED_CORE
  +    ap_rputs(" -D SHARED_CORE\n", r);
  +#endif
  +
  +/* This list displays the compiled in default paths: */
  +#ifdef HTTPD_ROOT
  +    ap_rputs(" -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n", r);
  +#endif
  +
  +#ifdef SUEXEC_BIN
  +    ap_rputs(" -D SUEXEC_BIN=\"" SUEXEC_BIN "\"\n", r);
  +#endif
  +
  +#if defined(SHARED_CORE) && defined(SHARED_CORE_DIR)
  +    ap_rputs(" -D SHARED_CORE_DIR=\"" SHARED_CORE_DIR "\"\n", r);
  +#endif
  +
  +#ifdef DEFAULT_PIDLOG
  +    ap_rputs(" -D DEFAULT_PIDLOG=\"" DEFAULT_PIDLOG "\"\n", r);
  +#endif
  +
  +#ifdef DEFAULT_SCOREBOARD
  +    ap_rputs(" -D DEFAULT_SCOREBOARD=\"" DEFAULT_SCOREBOARD "\"\n", r);
  +#endif
  +
  +#ifdef DEFAULT_LOCKFILE
  +    ap_rputs(" -D DEFAULT_LOCKFILE=\"" DEFAULT_LOCKFILE "\"\n", r);
  +#endif
  +
  +#ifdef DEFAULT_ERRORLOG
  +    ap_rputs(" -D DEFAULT_ERRORLOG=\"" DEFAULT_ERRORLOG "\"\n", r);
  +#endif
  +
  +
  +#ifdef AP_TYPES_CONFIG_FILE
  +    ap_rputs(" -D AP_TYPES_CONFIG_FILE=\"" AP_TYPES_CONFIG_FILE "\"\n", r);
  +#endif
  +
  +#ifdef SERVER_CONFIG_FILE
  +    ap_rputs(" -D SERVER_CONFIG_FILE=\"" SERVER_CONFIG_FILE "\"\n", r);
  +#endif
  +    ap_rputs("</pre></tt></dt>\n", r);
  +    ap_rputs("</dl><hr />", r);
  +    return 0;
  +}
  +
  +static int dump_a_hook(request_rec *r, hook_get_t hook_get)
  +{
  +    int i;
  +    char qs;
  +    hook_struct_t *elts;
  +    apr_array_header_t *hooks = hook_get();
  +
  +    if (!hooks) {
  +        return 0;
  +    }
  +
  +    if (r->args && strcasecmp(r->args, "hooks") == 0) {
  +        qs = '?';
  +    }
  +    else {
  +        qs = '#';
  +    }
  +
  +    elts = (hook_struct_t *) hooks->elts;
  +
  +    for (i = 0; i < hooks->nelts; i++) {
  +        ap_rprintf(r,
  +                       "&nbsp;&nbsp; %02d <a href=\"%c%s\">%s</a> <br/>",
  +                       elts[i].nOrder, qs, elts[i].szName, elts[i].szName);
  +    }
  +    return 0;
  +}
  +
  +static int show_hooks_settings(request_rec *r)
  +{
  +    int i;
  +    ap_rputs("<a name=\"hooks\"><h2>Active Hooks</h2></a>\n<dl>",
r);
  +
  +    for (i = 0; request_hooks[i].name; i++) {
  +        ap_rprintf(r, "<dt><strong>%s:</strong>\n <br /><tt>\n",
  +                   request_hooks[i].name);
  +        dump_a_hook(r, request_hooks[i].get);
  +        ap_rputs("\n  </tt>\n</dt>\n", r);
  +    }
  +
  +    ap_rputs("</dl>\n<hr />\n", r);
  +
  +    return 0;
  +}
  +
   static int display_info(request_rec *r)
   {
       module *modp = NULL;
  +    server_rec *serv = r->server;
       const char *more_info;
       const command_rec *cmd = NULL;
  -#ifdef NEVERMORE
  -    const handler_rec *hand = NULL;
  -#endif
  -    server_rec *serv = r->server;
       int comma = 0;
   
       if (strcmp(r->handler, "server-info"))
  @@ -330,14 +576,27 @@
   
       ap_set_content_type(r, "text/html");
   
  -    ap_rputs(DOCTYPE_HTML_3_2
  -             "<html><head><title>Server Information</title></head>\n",
r);
  -    ap_rputs("<body><h1 align=\"center\">Apache Server Information</h1>\n",
  +    ap_rputs(DOCTYPE_XHTML_1_0T
  +             "<html>\n <head>\n  <title>Server Information</title>\n
</head>\n",
                r);
  +    ap_rputs("<body><h1 style=\"text-align: center\">"
  +             "Apache Server Information</h1>\n", r);
       if (!r->args || strcasecmp(r->args, "list")) {
           if (!r->args) {
  -            ap_rputs("<dl><dt><tt><a href=\"#server\">Server Settings</a>,
",
  -                     r);
  +            ap_rputs("<dl><dt><tt>Subpages:<br />", r);
  +            ap_rputs("<a href=\"?config\">Configuration Files</a>, "
  +                     "<a href=\"?server\">Server Settings</a>, "
  +                     "<a href=\"?list\">Module List</a>,  "
  +                     "<a href=\"?hooks\">Active Hooks</a>", r);
  +            ap_rputs("</tt></dt></dl><hr />", r);
  +
  +            ap_rputs("<dl><dt><tt>Sections:<br />", r);
  +            ap_rputs("<a href=\"#server\">Server Settings</a>, "
  +                     "<a href=\"#hooks\">Active Hooks</a>", r);
  +            ap_rputs("</tt></dt></dl><hr />", r);
  +
  +            ap_rputs("<dl><dt><tt>Loaded Modules: <br />", r);
  +            /* TODO: Sort by Alpha */
               for (modp = ap_top_module; modp; modp = modp->next) {
                   ap_rprintf(r, "<a href=\"#%s\">%s</a>", modp->name,
                              modp->name);
  @@ -346,51 +605,16 @@
                   }
               }
               ap_rputs("</tt></dt></dl><hr />", r);
  -
           }
  +
           if (!r->args || !strcasecmp(r->args, "server")) {
  -            int max_daemons, forked, threaded;
  +            show_server_settings(r);
  +        }
   
  -            ap_rprintf(r,
  -                       "<dl><dt><a name=\"server\"><strong>Server
Version:</strong> "
  -                       "<font size=\"+1\"><tt>%s</tt></font></a></dt>\n",
  -                       ap_get_server_version());
  -            ap_rprintf(r,
  -                       "<dt><strong>Server Built:</strong> "
  -                       "<font size=\"+1\"><tt>%s</tt></font></dt>\n",
  -                       ap_get_server_built());
  -            ap_rprintf(r,
  -                       "<dt><strong>API Version:</strong> "
  -                       "<tt>%d:%d</tt></dt>\n", MODULE_MAGIC_NUMBER_MAJOR,
  -                       MODULE_MAGIC_NUMBER_MINOR);
  -            ap_rprintf(r,
  -                       "<dt><strong>Hostname/port:</strong> "
  -                       "<tt>%s:%u</tt></dt>\n", ap_get_server_name(r),
  -                       ap_get_server_port(r));
  -            ap_rprintf(r,
  -                       "<dt><strong>Timeouts:</strong> "
  -                       "<tt>connection: %d &nbsp;&nbsp; "
  -                       "keep-alive: %d</tt></dt>",
  -                       (int) (apr_time_sec(serv->timeout)),
  -                       (int) (apr_time_sec(serv->timeout)));
  -            ap_mpm_query(AP_MPMQ_MAX_DAEMON_USED, &max_daemons);
  -            ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded);
  -            ap_mpm_query(AP_MPMQ_IS_FORKED, &forked);
  -            ap_rprintf(r, "<dt><strong>MPM Name:</strong> <tt>%s</tt></dt>\n",
  -                       ap_show_mpm());
  -            ap_rprintf(r,
  -                       "<dt><strong>MPM Information:</strong> "
  -                       "<tt>Max Daemons: %d Threaded: %s Forked: %s</tt></dt>\n",
  -                       max_daemons, threaded ? "yes" : "no",
  -                       forked ? "yes" : "no");
  -            ap_rprintf(r,
  -                       "<dt><strong>Server Root:</strong> "
  -                       "<tt>%s</tt></dt>\n", ap_server_root);
  -            ap_rprintf(r,
  -                       "<dt><strong>Config File:</strong> "
  -                       "<tt>%s</tt></dt>\n", ap_conftree->filename);
  -            ap_rputs("</dl><hr />", r);
  +        if (!r->args || !strcasecmp(r->args, "hooks")) {
  +            show_hooks_settings(r);
           }
  +
           if (r->args && 0 == strcasecmp(r->args, "config")) {
               ap_rputs("<dl><dt><strong>Configuration:</strong>\n",
r);
               mod_info_module_cmds(r, NULL, ap_conftree, 0, 0);
  @@ -400,38 +624,18 @@
               for (modp = ap_top_module; modp; modp = modp->next) {
                   if (!r->args || !strcasecmp(modp->name, r->args)) {
                       ap_rprintf(r,
  -                               "<dl><dt><a name=\"%s\"><strong>Module
Name:</strong> "
  -                               "<font size=\"+1\"><tt>%s</tt></font></a></dt>\n",
  -                               modp->name, modp->name);
  +                               "<dl><dt><a name=\"%s\"><strong>Module
Name:</strong></a> "
  +                               "<font size=\"+1\"><tt><a href=\"?%s\">%s</a></tt></font></dt>\n",
  +                               modp->name, modp->name, modp->name);
                       ap_rputs("<dt><strong>Content handlers:</strong>
", r);
  -#ifdef NEVERMORE
  -                    hand = modp->handlers;
  -                    if (hand) {
  -                        while (hand) {
  -                            if (hand->content_type) {
  -                                ap_rprintf(r, " <tt>%s</tt>\n",
  -                                           hand->content_type);
  -                            }
  -                            else {
  -                                break;
  -                            }
  -                            hand++;
  -                            if (hand && hand->content_type) {
  -                                ap_rputs(",", r);
  -                            }
  -                        }
  -                    }
  -                    else {
  -                        ap_rputs("<tt> <em>none</em></tt>", r);
  -                    }
  -#else
  +
                       if (module_find_hook(modp, ap_hook_get_handler)) {
                           ap_rputs("<tt> <em>yes</em></tt>", r);
                       }
                       else {
                           ap_rputs("<tt> <em>none</em></tt>", r);
                       }
  -#endif
  +
                       ap_rputs("</dt>", r);
                       ap_rputs
                           ("<dt><strong>Configuration Phase Participation:</strong>\n",
  
  
  

Mime
View raw message