]> granicus.if.org Git - apache/blobdiff - modules/generators/mod_info.c
*) remove obsolete http_conf_globals.h
[apache] / modules / generators / mod_info.c
index 3c71808093bfcb217e4078a8bff635884e647fd2..a8af1bcbfa3f15706690f0e872824a51543ab50f 100644 (file)
 #include "http_main.h"
 #include "http_protocol.h"
 #include "util_script.h"
-#include "http_conf_globals.h"
+
+#if APR_HAVE_STRINGS_H
+#include <strings.h>
+#endif
 
 typedef struct {
     const char *name;                 /* matching module name */
@@ -111,7 +114,7 @@ static void *create_info_config(apr_pool_t *p, server_rec *s)
 {
     info_svr_conf *conf = (info_svr_conf *) apr_pcalloc(p, sizeof(info_svr_conf));
 
-    conf->more_info = apr_make_array(p, 20, sizeof(info_entry));
+    conf->more_info = apr_array_make(p, 20, sizeof(info_entry));
     return conf;
 }
 
@@ -121,7 +124,7 @@ static void *merge_info_config(apr_pool_t *p, void *basev, void *overridesv)
     info_svr_conf *base = (info_svr_conf *) basev;
     info_svr_conf *overrides = (info_svr_conf *) overridesv;
 
-    new->more_info = apr_append_arrays(p, overrides->more_info, base->more_info);
+    new->more_info = apr_array_append(p, overrides->more_info, base->more_info);
     return new;
 }
 
@@ -232,7 +235,12 @@ static void mod_info_module_cmds(request_rec * r, const command_rec * cmds,
                                                    sizeof(buf), 1));
                block_start--;
            }
-           tmptree = tmptree->parent->next;
+            if (tmptree->parent) {
+                tmptree = tmptree->parent->next;
+            }
+            else {
+                tmptree = NULL;
+            }
            nest--;
        }
 
@@ -264,10 +272,15 @@ static int display_info(request_rec *r)
     const char *cfname;
     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"))
+        return DECLINED;
+
     r->allowed |= (1 << M_GET);
     if (r->method_number != M_GET)
        return DECLINED;
@@ -323,6 +336,7 @@ static int display_info(request_rec *r)
                             "<font size=+1><tt>%s</tt></a></font>\n",
                             modp->name, modp->name);
                 ap_rputs("<dt><strong>Content handlers:</strong>", r);
+#ifdef NEVERMORE
                 hand = modp->handlers;
                 if (hand) {
                     while (hand) {
@@ -341,6 +355,9 @@ static int display_info(request_rec *r)
                 else {
                     ap_rputs("<tt> <EM>none</EM></tt>", r);
                 }
+#else
+                ap_rputs("<tt> <EM>(code broken)</EM></tt>", r);
+#endif
                 ap_rputs("<dt><strong>Configuration Phase Participation:</strong> \n",
                       r);
                 if (modp->create_dir_config) {
@@ -435,7 +452,7 @@ static const char *add_module_info(cmd_parms *cmd, void *dummy,
     server_rec *s = cmd->server;
     info_svr_conf *conf = (info_svr_conf *) ap_get_module_config(s->module_config,
                                                               &info_module);
-    info_entry *new = apr_push_array(conf->more_info);
+    info_entry *new = apr_array_push(conf->more_info);
 
     new->name = name;
     new->info = info;
@@ -449,11 +466,10 @@ static const command_rec info_cmds[] =
     {NULL}
 };
 
-static const handler_rec info_handlers[] =
+static void register_hooks(apr_pool_t *p)
 {
-    {"server-info", display_info},
-    {NULL}
-};
+    ap_hook_handler(display_info, NULL, NULL, APR_HOOK_MIDDLE);
+}
 
 module AP_MODULE_DECLARE_DATA info_module =
 {
@@ -463,6 +479,5 @@ module AP_MODULE_DECLARE_DATA info_module =
     create_info_config,         /* server config */
     merge_info_config,          /* merge server config */
     info_cmds,                  /* command apr_table_t */
-    info_handlers,              /* handlers */
-    NULL,                       /* filename translation */
+    register_hooks
 };