summaryrefslogtreecommitdiff
path: root/modules/generators
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2012-02-16 02:47:54 +0100
committerStefan Fritsch <sf@sfritsch.de>2012-02-16 02:47:54 +0100
commit212cb6c2dcb419aaa6c848406136ec05e98c8632 (patch)
tree3c6f8cc25cde8781809bfeb92ebcadac341b1af4 /modules/generators
parente072a2dd866b7cb9f14319b80326a4e7fd16fcdf (diff)
downloadapache2-212cb6c2dcb419aaa6c848406136ec05e98c8632.tar.gz
Import upstream release candidate 2.4.1upstream/2.4.1
Diffstat (limited to 'modules/generators')
-rw-r--r--modules/generators/mod_autoindex.c2
-rw-r--r--modules/generators/mod_info.c83
2 files changed, 75 insertions, 10 deletions
diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c
index bf8005ed..926f8c83 100644
--- a/modules/generators/mod_autoindex.c
+++ b/modules/generators/mod_autoindex.c
@@ -1209,7 +1209,7 @@ static char *find_title(request_rec *r)
}
n = sizeof(char) * (MAX_STRING_LEN - 1);
apr_file_read(thefile, titlebuf, &n);
- if (n <= 0) {
+ if (n == 0) {
apr_file_close(thefile);
return NULL;
}
diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c
index b685560b..360290c7 100644
--- a/modules/generators/mod_info.c
+++ b/modules/generators/mod_info.c
@@ -61,7 +61,9 @@
#include "http_request.h"
#include "util_script.h"
#include "ap_mpm.h"
+#include "mpm_common.h"
#include <stdio.h>
+#include <stdlib.h>
typedef struct
{
@@ -300,6 +302,10 @@ static hook_lookup_t startup_hooks[] = {
{"Test Configuration", ap_hook_get_test_config},
{"Post Configuration", ap_hook_get_post_config},
{"Open Logs", ap_hook_get_open_logs},
+ {"Pre-MPM", ap_hook_get_pre_mpm},
+ {"MPM", ap_hook_get_mpm},
+ {"Drop Privileges", ap_hook_get_drop_privileges},
+ {"Retrieve Optional Functions", ap_hook_get_optional_fn_retrieve},
{"Child Init", ap_hook_get_child_init},
{NULL},
};
@@ -309,6 +315,7 @@ static hook_lookup_t request_hooks[] = {
{"Create Connection", ap_hook_get_create_connection},
{"Process Connection", ap_hook_get_process_connection},
{"Create Request", ap_hook_get_create_request},
+ {"Pre-Read Request", ap_hook_get_pre_read_request},
{"Post-Read Request", ap_hook_get_post_read_request},
{"Header Parse", ap_hook_get_header_parser},
{"HTTP Scheme", ap_hook_get_http_scheme},
@@ -316,15 +323,34 @@ static hook_lookup_t request_hooks[] = {
{"Quick Handler", ap_hook_get_quick_handler},
{"Translate Name", ap_hook_get_translate_name},
{"Map to Storage", ap_hook_get_map_to_storage},
- {"Check Access", ap_hook_get_access_checker},
+ {"Check Access", ap_hook_get_access_checker_ex},
+ {"Check Access (legacy)", ap_hook_get_access_checker},
{"Verify User ID", ap_hook_get_check_user_id},
+ {"Note Authentication Failure", ap_hook_get_note_auth_failure},
{"Verify User Access", ap_hook_get_auth_checker},
{"Check Type", ap_hook_get_type_checker},
{"Fixups", ap_hook_get_fixups},
{"Insert Filters", ap_hook_get_insert_filter},
{"Content Handlers", ap_hook_get_handler},
- {"Logging", ap_hook_get_log_transaction},
+ {"Transaction Logging", ap_hook_get_log_transaction},
{"Insert Errors", ap_hook_get_insert_error_filter},
+ {"Generate Log ID", ap_hook_get_generate_log_id},
+ {NULL},
+};
+
+static hook_lookup_t other_hooks[] = {
+ {"Monitor", ap_hook_get_monitor},
+ {"Child Status", ap_hook_get_child_status},
+ {"End Generation", ap_hook_get_end_generation},
+ {"Error Logging", ap_hook_get_error_log},
+ {"Query MPM Attributes", ap_hook_get_mpm_query},
+ {"Query MPM Name", ap_hook_get_mpm_get_name},
+ {"Register Timed Callback", ap_hook_get_mpm_register_timed_callback},
+ {"Extend Expression Parser", ap_hook_get_expr_lookup},
+ {"Set Management Items", ap_hook_get_get_mgmt_items},
+#if AP_ENABLE_EXCEPTION_HOOK
+ {"Handle Fatal Exceptions", ap_hook_get_fatal_exception},
+#endif
{NULL},
};
@@ -646,16 +672,48 @@ static int show_active_hooks(request_rec * r)
ap_rputs("\n </tt>\n</dt>\n", r);
}
+ ap_rputs
+ ("</dl>\n<hr />\n<h2><a name=\"other_hooks\">Other Hooks</a></h2>\n<dl>",
+ r);
+
+ for (i = 0; other_hooks[i].name; i++) {
+ ap_rprintf(r, "<dt><strong>%s:</strong>\n <br /><tt>\n",
+ other_hooks[i].name);
+ dump_a_hook(r, other_hooks[i].get);
+ ap_rputs("\n </tt>\n</dt>\n", r);
+ }
+
ap_rputs("</dl>\n<hr />\n", r);
return 0;
}
+static int cmp_module_name(const void *a_, const void *b_)
+{
+ const module * const *a = a_;
+ const module * const *b = b_;
+ return strcmp((*a)->name, (*b)->name);
+}
+
+static apr_array_header_t *get_sorted_modules(apr_pool_t *p)
+{
+ apr_array_header_t *arr = apr_array_make(p, 64, sizeof(module *));
+ module *modp, **entry;
+ for (modp = ap_top_module; modp; modp = modp->next) {
+ entry = &APR_ARRAY_PUSH(arr, module *);
+ *entry = modp;
+ }
+ qsort(arr->elts, arr->nelts, sizeof(module *), cmp_module_name);
+ return arr;
+}
+
static int display_info(request_rec * r)
{
- module *modp;
+ module *modp = NULL;
const char *more_info;
const command_rec *cmd;
+ apr_array_header_t *modules = NULL;
+ int i;
if (strcmp(r->handler, "server-info")) {
return DECLINED;
@@ -687,17 +745,19 @@ static int display_info(request_rec * r)
ap_rputs("<a href=\"#modules\">Loaded Modules</a>, "
"<a href=\"#server\">Server Settings</a>, "
"<a href=\"#startup_hooks\">Startup Hooks</a>, "
- "<a href=\"#request_hooks\">Request Hooks</a>", r);
+ "<a href=\"#request_hooks\">Request Hooks</a>, "
+ "<a href=\"#other_hooks\">Other Hooks</a>", r);
ap_rputs("</tt></dt></dl><hr />", r);
ap_rputs("<h2><a name=\"modules\">Loaded Modules</a></h2>"
"<dl><dt><tt>", r);
- /* TODO: Sort by Alpha */
- for (modp = ap_top_module; modp; modp = modp->next) {
+ modules = get_sorted_modules(r->pool);
+ for (i = 0; i < modules->nelts; i++) {
+ modp = APR_ARRAY_IDX(modules, i, module *);
ap_rprintf(r, "<a href=\"#%s\">%s</a>", modp->name,
modp->name);
- if (modp->next) {
+ if (i < modules->nelts) {
ap_rputs(", ", r);
}
}
@@ -719,7 +779,10 @@ static int display_info(request_rec * r)
}
else {
int comma = 0;
- for (modp = ap_top_module; modp; modp = modp->next) {
+ if (!modules)
+ modules = get_sorted_modules(r->pool);
+ for (i = 0; i < modules->nelts; i++) {
+ modp = APR_ARRAY_IDX(modules, i, module *);
if (!r->args || !strcasecmp(modp->name, r->args)) {
ap_rprintf(r,
"<dl><dt><a name=\"%s\"><strong>Module Name:</strong></a> "
@@ -825,7 +888,9 @@ static int display_info(request_rec * r)
}
else {
ap_rputs("<dl><dt>Server Module List</dt>", r);
- for (modp = ap_top_module; modp; modp = modp->next) {
+ modules = get_sorted_modules(r->pool);
+ for (i = 0; i < modules->nelts; i++) {
+ modp = APR_ARRAY_IDX(modules, i, module *);
ap_rputs("<dd>", r);
ap_rputs(modp->name, r);
ap_rputs("</dd>", r);