From bb6cc59dc6a067b916d811a50c55c0c219106be2 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Fri, 30 Dec 2011 11:00:31 +0000 Subject: [PATCH] Display registered providers git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1225799 13f79535-47bb-0310-9956-ffa450edef68 --- modules/generators/mod_info.c | 64 +++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c index 360290c7bb..75c37782bc 100644 --- a/modules/generators/mod_info.c +++ b/modules/generators/mod_info.c @@ -62,6 +62,7 @@ #include "util_script.h" #include "ap_mpm.h" #include "mpm_common.h" +#include "ap_provider.h" #include #include @@ -688,6 +689,57 @@ static int show_active_hooks(request_rec * r) return 0; } +static int cmp_provider_groups(const void *a_, const void *b_) +{ + const ap_list_provider_groups_t *a = a_, *b = b_; + int ret = strcmp(a->provider_group, b->provider_group); + if (!ret) + ret = strcmp(a->provider_version, b->provider_version); + return ret; +} + +static int cmp_provider_names(const void *a_, const void *b_) +{ + const ap_list_provider_names_t *a = a_, *b = b_; + return strcmp(a->provider_name, b->provider_name); +} + +static void show_providers(request_rec *r) +{ + apr_array_header_t *groups = ap_list_provider_groups(r->pool); + ap_list_provider_groups_t *group; + apr_array_header_t *names; + ap_list_provider_names_t *name; + int i,j; + const char *cur_group = NULL; + + qsort(groups->elts, groups->nelts, sizeof(ap_list_provider_groups_t), + cmp_provider_groups); + ap_rputs("

Providers

\n
", r); + + for (i = 0; i < groups->nelts; i++) { + group = &APR_ARRAY_IDX(groups, i, ap_list_provider_groups_t); + if (!cur_group || strcmp(cur_group, group->provider_group) != 0) { + if (cur_group) + ap_rputs("\n\n", r); + cur_group = group->provider_group; + ap_rprintf(r, "
%s (version %s):" + "\n
\n", cur_group, group->provider_version); + } + names = ap_list_provider_names(r->pool, group->provider_group, + group->provider_version); + qsort(names->elts, names->nelts, sizeof(ap_list_provider_names_t), + cmp_provider_names); + for (j = 0; j < names->nelts; j++) { + name = &APR_ARRAY_IDX(names, j, ap_list_provider_names_t); + ap_rprintf(r, "  %s
", name->provider_name); + } + } + if (cur_group) + ap_rputs("\n
\n", r); + ap_rputs("
\n
\n", r); +} + static int cmp_module_name(const void *a_, const void *b_) { const module * const *a = a_; @@ -737,8 +789,9 @@ static int display_info(request_rec * r) ap_rputs("
Subpages:
", r); ap_rputs("Configuration Files, " "Server Settings, " - "Module List, " - "Active Hooks", r); + "Module List, " + "Active Hooks, " + "Available Providers", r); ap_rputs("

", r); ap_rputs("
Sections:
", r); @@ -746,7 +799,8 @@ static int display_info(request_rec * r) "Server Settings, " "Startup Hooks, " "Request Hooks, " - "Other Hooks", r); + "Other Hooks, " + "Providers", r); ap_rputs("

", r); ap_rputs("

Loaded Modules

" @@ -772,6 +826,10 @@ static int display_info(request_rec * r) show_active_hooks(r); } + if (!r->args || !strcasecmp(r->args, "providers")) { + show_providers(r); + } + if (r->args && 0 == strcasecmp(r->args, "config")) { ap_rputs("
Configuration:\n", r); mod_info_module_cmds(r, NULL, ap_conftree, 0, 0); -- 2.40.0