httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1356879 - in /httpd/httpd/branches/2.4.x: CHANGES STATUS include/ap_mmn.h include/ap_provider.h modules/generators/mod_info.c server/provider.c
Date Tue, 03 Jul 2012 19:29:12 GMT
Author: sf
Date: Tue Jul  3 19:29:11 2012
New Revision: 1356879

URL: http://svn.apache.org/viewvc?rev=1356879&view=rev
Log:
Merge r1225798, r1225799:
	
	mod_info: Display registered providers.

Reviewed by: sf, jorton, covener

Modified:
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/include/ap_mmn.h
    httpd/httpd/branches/2.4.x/include/ap_provider.h
    httpd/httpd/branches/2.4.x/modules/generators/mod_info.c
    httpd/httpd/branches/2.4.x/server/provider.c

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1356879&r1=1356878&r2=1356879&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue Jul  3 19:29:11 2012
@@ -3,6 +3,8 @@
 
 Changes with Apache 2.4.3
 
+  *) mod_info: Display all registered providers. [Stefan Fritsch]
+
   *) mod_ssl: Send the error message for speaking http to an https port using
      HTTP/1.0 instead of HTTP/0.9, and omit the link that may be wrong when
      using SNI. PR 50823. [Stefan Fritsch]

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1356879&r1=1356878&r2=1356879&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue Jul  3 19:29:11 2012
@@ -88,12 +88,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_info: Display registered providers.
-    trunk patches: http://svn.apache.org/viewvc?rev=1225798&view=rev
-                   http://svn.apache.org/viewvc?rev=1225799&view=rev
-    2.4 patch: http://people.apache.org/~sf/mod_info-show-providers.diff
-    +1: sf, jorton, covener
-
   * mod_proxy: Use the the same hostname for SNI as for the HTTP request when
      forwarding to SSL backends. PR 53134.
       Trunk version of patch:

Modified: httpd/httpd/branches/2.4.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/ap_mmn.h?rev=1356879&r1=1356878&r2=1356879&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.4.x/include/ap_mmn.h Tue Jul  3 19:29:11 2012
@@ -393,6 +393,7 @@
  * 20120211.1 (2.4.2-dev)  Add AP_HAVE_C99
  * 20120211.2 (2.4.2-dev)  Add ap_runtime_dir_relative
  * 20120211.3 (2.4.2-dev)  Add forcerecovery to proxy_balancer_shared struct
+ * 20120211.4 (2.4.2-dev)  Add ap_list_provider_groups()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -400,7 +401,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20120211
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 3                   /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 4                   /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/branches/2.4.x/include/ap_provider.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/ap_provider.h?rev=1356879&r1=1356878&r2=1356879&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/include/ap_provider.h (original)
+++ httpd/httpd/branches/2.4.x/include/ap_provider.h Tue Jul  3 19:29:11 2012
@@ -36,6 +36,10 @@ typedef struct {
     const char *provider_name;
 } ap_list_provider_names_t;
 
+typedef struct {
+    const char *provider_group;
+    const char *provider_version;
+} ap_list_provider_groups_t;
 
 /**
  * This function is used to register a provider with the global
@@ -78,6 +82,16 @@ AP_DECLARE(apr_array_header_t *) ap_list
                                               const char *provider_group,
                                               const char *provider_version);
 
+/**
+ * This function is used to retrieve a list (array) of provider groups and versions
+ * @param pool The pool to create any storage from
+ * @return pointer to array of ap_list_provider_groups_t of provider groups
+ *         and versions (could be empty)
+ */
+
+AP_DECLARE(apr_array_header_t *) ap_list_provider_groups(apr_pool_t *pool);
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: httpd/httpd/branches/2.4.x/modules/generators/mod_info.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/generators/mod_info.c?rev=1356879&r1=1356878&r2=1356879&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/generators/mod_info.c (original)
+++ httpd/httpd/branches/2.4.x/modules/generators/mod_info.c Tue Jul  3 19:29:11 2012
@@ -62,6 +62,7 @@
 #include "util_script.h"
 #include "ap_mpm.h"
 #include "mpm_common.h"
+#include "ap_provider.h"
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -688,6 +689,57 @@ static int show_active_hooks(request_rec
     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("<h2><a name=\"providers\">Providers</a></h2>\n<dl>",
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</dt>\n", r);
+            cur_group = group->provider_group;
+            ap_rprintf(r, "<dt><strong>%s</strong> (version <tt>%s</tt>):"
+                          "\n <br />\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, "<tt>&nbsp;&nbsp;%s</tt><br/>", name->provider_name);
+        }
+    }
+    if (cur_group)
+        ap_rputs("\n</dt>\n", r);
+    ap_rputs("</dl>\n<hr />\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("<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);
+                     "<a href=\"?list\">Module List</a>, "
+                     "<a href=\"?hooks\">Active Hooks</a>, "
+                     "<a href=\"?providers\">Available Providers</a>", r);
             ap_rputs("</tt></dt></dl><hr />", r);
 
             ap_rputs("<dl><dt><tt>Sections:<br />", r);
@@ -746,7 +799,8 @@ static int display_info(request_rec * r)
                      "<a href=\"#server\">Server Settings</a>, "
                      "<a href=\"#startup_hooks\">Startup Hooks</a>, "
                      "<a href=\"#request_hooks\">Request Hooks</a>, "
-                     "<a href=\"#other_hooks\">Other Hooks</a>", r);
+                     "<a href=\"#other_hooks\">Other Hooks</a>, "
+                     "<a href=\"#providers\">Providers</a>", r);
             ap_rputs("</tt></dt></dl><hr />", r);
 
             ap_rputs("<h2><a name=\"modules\">Loaded Modules</a></h2>"
@@ -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("<dl><dt><strong>Configuration:</strong>\n",
r);
             mod_info_module_cmds(r, NULL, ap_conftree, 0, 0);

Modified: httpd/httpd/branches/2.4.x/server/provider.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/provider.c?rev=1356879&r1=1356878&r2=1356879&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/provider.c (original)
+++ httpd/httpd/branches/2.4.x/server/provider.c Tue Jul  3 19:29:11 2012
@@ -163,3 +163,35 @@ AP_DECLARE(apr_array_header_t *) ap_list
     }
     return ret;
 }
+
+AP_DECLARE(apr_array_header_t *) ap_list_provider_groups(apr_pool_t *pool)
+{
+    apr_array_header_t *ret = apr_array_make(pool, 10, sizeof(ap_list_provider_groups_t));
+    ap_list_provider_groups_t *entry;
+    apr_hash_t *provider_group_hash;
+    apr_hash_index_t *groups_hi, *vers_hi;
+    char *group, *version;
+
+    if (global_providers_names == NULL)
+        return ret;
+
+    for (groups_hi = apr_hash_first(pool, global_providers_names);
+         groups_hi;
+         groups_hi = apr_hash_next(groups_hi))
+    {
+        apr_hash_this(groups_hi, (void *)&group, NULL, (void *)&provider_group_hash);
+        if (provider_group_hash == NULL)
+            continue;
+        for (vers_hi = apr_hash_first(pool, provider_group_hash);
+             vers_hi;
+             vers_hi = apr_hash_next(vers_hi))
+        {
+            apr_hash_this(vers_hi, (void *)&version, NULL, NULL);
+
+            entry = apr_array_push(ret);
+            entry->provider_group = group;
+            entry->provider_version = version;
+        }
+    }
+    return ret;
+}



Mime
View raw message