httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1725609 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_balancer.c mod_proxy_hcheck.c
Date Tue, 19 Jan 2016 20:48:33 GMT
Author: jim
Date: Tue Jan 19 20:48:33 2016
New Revision: 1725609

URL: http://svn.apache.org/viewvc?rev=1725609&view=rev
Log:
And make the list of health check conditions viewable via
the balancer manager :)

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1725609&r1=1725608&r2=1725609&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Tue Jan 19 20:48:33 2016
@@ -552,10 +552,13 @@ struct proxy_balancer_method {
 #define PROXY_DECLARE_DATA             __declspec(dllimport)
 #endif
 
+APR_DECLARE_OPTIONAL_FN(void, hc_show_exprs, (request_rec *));
+
 APR_DECLARE_OPTIONAL_FN(const char *, set_worker_hc_param,
                         (apr_pool_t *, server_rec *, proxy_worker *,
                          const char *, const char *, void *));
 
+
 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
                           proxy_worker *worker, proxy_server_conf *conf, char *url,
                           const char *proxyhost, apr_port_t proxyport))

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=1725609&r1=1725608&r2=1725609&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Tue Jan 19 20:48:33 2016
@@ -33,6 +33,9 @@ static APR_OPTIONAL_FN_TYPE(set_worker_h
 static int (*ap_proxy_retry_worker_fn)(const char *proxy_function,
         proxy_worker *worker, server_rec *s) = NULL;
 
+static APR_OPTIONAL_FN_TYPE(hc_show_exprs) *hc_show_exprs_f = NULL;
+
+
 /*
  * Register our mutex type before the config is read so we
  * can adjust the mutex settings using the Mutex directive.
@@ -49,6 +52,7 @@ static int balancer_pre_config(apr_pool_
         return rv;
     }
     set_worker_hc_param_f = APR_RETRIEVE_OPTIONAL_FN(set_worker_hc_param);
+    hc_show_exprs_f = APR_RETRIEVE_OPTIONAL_FN(hc_show_exprs);
     return OK;
 }
 
@@ -1572,6 +1576,9 @@ static int balancer_handler(request_rec
             ++balancer;
         }
         ap_rputs("<hr />\n", r);
+        if (hc_show_exprs_f) {
+            hc_show_exprs_f(r);
+        }
         if (wsel && bsel) {
             ap_rputs("<h3>Edit worker settings for ", r);
             ap_rvputs(r, (*wsel->s->uds_path?"<i>":""), ap_proxy_worker_name(r->pool,
wsel), (*wsel->s->uds_path?"</i>":""), "</h3>\n", NULL);

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c?rev=1725609&r1=1725608&r2=1725609&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c Tue Jan 19 20:48:33 2016
@@ -824,6 +824,34 @@ static int hc_post_config(apr_pool_t *p,
     return OK;
 }
 
+static void hc_show_exprs(request_rec *r)
+{
+    const apr_table_entry_t *elts;
+    const apr_array_header_t *hdr;
+    int i;
+    sctx_t *ctx = (sctx_t *) ap_get_module_config(r->server->module_config,
+                                                  &proxy_hcheck_module);
+    if (apr_is_empty_table(ctx->conditions))
+        return;
+
+    ap_rputs("\n\n<table>"
+             "<tr><th colspan=\"2\">Health check cond. expressions:</th></tr>\n"
+             "<tr><th>Expr name</th><th>Expression</th></tr>\n",
r);
+
+    hdr = apr_table_elts(ctx->conditions);
+    elts = (const apr_table_entry_t *) hdr->elts;
+    for (i = 0; i < hdr->nelts; ++i) {
+        hc_condition_t *cond;
+        if (!elts[i].key) {
+            continue;
+        }
+        cond = (hc_condition_t *)elts[i].val;
+        ap_rprintf(r, "<tr><td>%s</td><td>%s</td></tr>\n",
elts[i].key,
+                   cond->expr);
+    }
+    ap_rputs("</table><hr/>\n", r);
+}
+
 static const command_rec command_table[] = {
     AP_INIT_RAW_ARGS("ProxyHCTemplate", set_hc_template, NULL, OR_FILEINFO,
                      "Health check template"),
@@ -837,6 +865,7 @@ static void hc_register_hooks(apr_pool_t
     static const char *const aszPre[] = { "mod_proxy_balancer.c", "mod_proxy.c", NULL};
     static const char *const aszSucc[] = { "mod_watchdog.c", NULL};
     APR_REGISTER_OPTIONAL_FN(set_worker_hc_param);
+    APR_REGISTER_OPTIONAL_FN(hc_show_exprs);
     ap_hook_post_config(hc_post_config, aszPre, aszSucc, APR_HOOK_LAST);
 }
 



Mime
View raw message