enc_path, enc_search, enc_user, enc_fpath, enc_parm
};
+typedef enum {
+ NONE, TCP, OPTIONS, HEAD, GET, CPING, PROVIDER, EOT
+} hcmethod_t;
+
+typedef struct {
+ hcmethod_t method;
+ char *name;
+} hcmethods_t;
+
+static hcmethods_t hcmethods[] = {
+ {NONE, "NONE"},
+ {TCP, "TCP"},
+ {OPTIONS, "OPTIONS"},
+ {HEAD, "HEAD"},
+ {GET, "GET"},
+ {CPING, "CPING"},
+ {PROVIDER, "PROVIDER"},
+ {EOT, NULL}
+};
+
#define BALANCER_PREFIX "balancer://"
#if APR_CHARSET_EBCDIC
char redirect[PROXY_WORKER_MAX_ROUTE_SIZE]; /* temporary balancing redirection route */
char flusher[PROXY_WORKER_MAX_SCHEME_SIZE]; /* flush provider used by mod_proxy_fdpass */
char uds_path[PROXY_WORKER_MAX_NAME_SIZE]; /* path to worker's unix domain socket if applicable */
- char hurl[PROXY_WORKER_MAX_ROUTE_SIZE]; /* health check url */
+ char hcuri[PROXY_WORKER_MAX_ROUTE_SIZE]; /* health check uri */
int lbset; /* load balancer cluster set */
int retries; /* number of retries on this worker */
int lbstatus; /* Current lbstatus */
int hmax; /* Hard maximum on the total number of connections */
int flush_wait; /* poll wait time in microseconds if flush_auto */
int index; /* shm array index */
- int method; /* method to use for health check */
int passes; /* number of successes for check to pass */
int pcount; /* current count of passes */
int fails; /* number of failures for check to fail */
flush_off,
flush_on,
flush_auto
- } flush_packets; /* control AJP flushing */
+ } flush_packets; /* control AJP flushing */
+ hcmethod_t method; /* method to use for health check */
apr_time_t updated; /* timestamp of last update */
apr_time_t error_time; /* time of the last error */
apr_interval_time_t ttl; /* maximum amount of time in seconds a connection
#include "ap_slotmem.h"
#include "ap_expr.h"
-
module AP_MODULE_DECLARE_DATA proxy_hcheck_module;
#define HCHECK_WATHCHDOG_NAME ("_proxy_hcheck_")
/* The watchdog runs every 5 seconds, which is also the minimal check */
#define HCHECK_WATHCHDOG_INTERVAL (5)
-static char *methods[] = {
- "NULL", "OPTIONS", "HEAD", "CPING", NULL
-};
-
typedef struct {
char *name;
- int method;
+ hcmethod_t method;
int passes;
int fails;
apr_interval_time_t interval;
worker->s->interval = template->interval;
worker->s->passes = template->passes;
worker->s->fails = template->fails;
- PROXY_STRNCPY(worker->s->hurl, template->hurl);
+ PROXY_STRNCPY(worker->s->hcuri, template->hurl);
} else {
temp->method = template->method;
temp->interval = template->interval;
return apr_psprintf(p, "Unknown ProxyHCTemplate name: %s", val);
}
else if (!strcasecmp(key, "hcmethod")) {
- for (ival = 1; methods[ival]; ival++) {
- if (!ap_casecmpstr(val, methods[ival])) {
+ hcmethods_t *method = hcmethods;
+ for (; method->name; method++) {
+ if (!ap_casecmpstr(val, method->name)) {
if (worker) {
- worker->s->method = ival;
+ worker->s->method = method->method;
} else {
- temp->method = ival;
+ temp->method = method->method;
}
return NULL;
}
}
}
else if (!strcasecmp(key, "hcuri")) {
- if (strlen(val) >= sizeof(worker->s->hurl))
+ if (strlen(val) >= sizeof(worker->s->hcuri))
return apr_psprintf(p, "Health check uri length must be < %d characters",
- (int)sizeof(worker->s->hurl));
+ (int)sizeof(worker->s->hcuri));
if (worker) {
- PROXY_STRNCPY(worker->s->hurl, val);
+ PROXY_STRNCPY(worker->s->hcuri, val);
} else {
temp->hurl = apr_pstrdup(p, val);
}