From 26019784af492141fd51beb9b5f06963eed26296 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Mon, 18 Jan 2016 16:54:06 +0000 Subject: [PATCH] Expose this in our API git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725306 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.h | 7 +++++++ modules/proxy/mod_proxy_balancer.c | 13 +------------ modules/proxy/proxy_util.c | 11 +++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 06c9673f6a..d973f1f027 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -1119,6 +1119,13 @@ int ap_proxy_lb_workers(void); */ PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme); +/** + * Return the name of the health check method (eg: "OPTIONS"). + * @param method method enum + * @return name of method + */ +PROXY_DECLARE (const char *) ap_proxy_show_hcmethod(hcmethod_t method); + /** * Strip a unix domain socket (UDS) prefix from the input URL * @param p pool to allocate result from diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 376100546c..d24fe6935e 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -973,17 +973,6 @@ static void push2table(const char *input, apr_table_t *params, } } -static const char *show_hcmethod(hcmethod_t method) -{ - hcmethods_t *m = hcmethods; - for (; m->name; m++) { - if (m->method == method) { - return m->name; - } - } - return "???"; -} - /* Manages the loadfactors and member status * The balancer, worker and nonce are obtained from * the request args (?b=...&w=...&nonce=....). @@ -1568,7 +1557,7 @@ static int balancer_handler(request_rec *r) ap_rputs("", r); ap_rputs(apr_strfsize(worker->s->read, fbuf), r); if (set_worker_hc_param_f) { - ap_rprintf(r, "%s", show_hcmethod(worker->s->method)); + ap_rprintf(r, "%s", ap_proxy_show_hcmethod(worker->s->method)); ap_rprintf(r, "%d", (int)apr_time_sec(worker->s->interval)); ap_rprintf(r, "%d", worker->s->passes); ap_rprintf(r, "%d", worker->s->fails); diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index f2695cef3c..badc6fa1f4 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -3699,6 +3699,17 @@ PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme) return 0; } +PROXY_DECLARE (const char *) ap_proxy_show_hcmethod(hcmethod_t method) +{ + hcmethods_t *m = hcmethods; + for (; m->name; m++) { + if (m->method == method) { + return m->name; + } + } + return "???"; +} + void proxy_util_register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(ap_proxy_retry_worker); -- 2.40.0