#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))
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.
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;
}
++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);
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"),
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);
}