mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Since these are externs, prepend proxy_
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1728148 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -43,7 +43,8 @@ APR_DECLARE_OPTIONAL_FN(char *, ssl_var_lookup,
|
||||
*/
|
||||
static APR_OPTIONAL_FN_TYPE(set_worker_hc_param) *set_worker_hc_param_f = NULL;
|
||||
|
||||
hcmethods_t hcmethods[] = {
|
||||
/* Externals */
|
||||
proxy_hcmethods_t proxy_hcmethods[] = {
|
||||
{NONE, "NONE", 1},
|
||||
{TCP, "TCP", 1},
|
||||
{OPTIONS, "OPTIONS", 1},
|
||||
@@ -54,6 +55,21 @@ hcmethods_t hcmethods[] = {
|
||||
{EOT, NULL, 1}
|
||||
};
|
||||
|
||||
proxy_wstat_t proxy_wstat_tbl[] = {
|
||||
{PROXY_WORKER_INITIALIZED, PROXY_WORKER_INITIALIZED_FLAG, "Init "},
|
||||
{PROXY_WORKER_IGNORE_ERRORS, PROXY_WORKER_IGNORE_ERRORS_FLAG, "Ign "},
|
||||
{PROXY_WORKER_DRAIN, PROXY_WORKER_DRAIN_FLAG, "Drn "},
|
||||
{PROXY_WORKER_GENERIC, PROXY_WORKER_GENERIC_FLAG, "Gen "},
|
||||
{PROXY_WORKER_IN_SHUTDOWN, PROXY_WORKER_IN_SHUTDOWN_FLAG, "Shut "},
|
||||
{PROXY_WORKER_DISABLED, PROXY_WORKER_DISABLED_FLAG, "Dis "},
|
||||
{PROXY_WORKER_STOPPED, PROXY_WORKER_STOPPED_FLAG, "Stop "},
|
||||
{PROXY_WORKER_IN_ERROR, PROXY_WORKER_IN_ERROR_FLAG, "Err "},
|
||||
{PROXY_WORKER_HOT_STANDBY, PROXY_WORKER_HOT_STANDBY_FLAG, "Stby "},
|
||||
{PROXY_WORKER_FREE, PROXY_WORKER_FREE_FLAG, "Free "},
|
||||
{PROXY_WORKER_HC_FAIL, PROXY_WORKER_HC_FAIL_FLAG, "HcFl "},
|
||||
{0x0, '\0', NULL}
|
||||
};
|
||||
|
||||
static const char * const proxy_id = "proxy";
|
||||
apr_global_mutex_t *proxy_mutex = NULL;
|
||||
|
||||
|
@@ -83,9 +83,17 @@ typedef struct {
|
||||
hcmethod_t method;
|
||||
char *name;
|
||||
int implemented;
|
||||
} hcmethods_t;
|
||||
} proxy_hcmethods_t;
|
||||
|
||||
extern hcmethods_t hcmethods[];
|
||||
typedef struct {
|
||||
unsigned int bit;
|
||||
char flag;
|
||||
const char *name;
|
||||
} proxy_wstat_t;
|
||||
|
||||
/* These 2 are in mod_proxy.c */
|
||||
extern proxy_hcmethods_t proxy_hcmethods[];
|
||||
extern proxy_wstat_t proxy_wstat_tbl[];
|
||||
|
||||
#define BALANCER_PREFIX "balancer://"
|
||||
|
||||
@@ -285,7 +293,7 @@ struct proxy_conn_pool {
|
||||
/* worker status bits */
|
||||
/*
|
||||
* NOTE: Keep up-to-date w/ proxy_wstat_tbl[]
|
||||
* in proxy_util.c !
|
||||
* in mod_proxy.c !
|
||||
*/
|
||||
#define PROXY_WORKER_INITIALIZED 0x0001
|
||||
#define PROXY_WORKER_IGNORE_ERRORS 0x0002
|
||||
|
@@ -1101,6 +1101,10 @@ static int balancer_handler(request_rec *r)
|
||||
else
|
||||
*wsel->s->redirect = '\0';
|
||||
}
|
||||
/*
|
||||
* TODO: Look for all 'w_status_#' keys and then loop thru
|
||||
* on that # character, since the character == the flag
|
||||
*/
|
||||
if ((val = apr_table_get(params, "w_status_I"))) {
|
||||
ap_proxy_set_wstatus(PROXY_WORKER_IGNORE_ERRORS_FLAG, atoi(val), wsel);
|
||||
}
|
||||
@@ -1113,6 +1117,12 @@ static int balancer_handler(request_rec *r)
|
||||
if ((val = apr_table_get(params, "w_status_H"))) {
|
||||
ap_proxy_set_wstatus(PROXY_WORKER_HOT_STANDBY_FLAG, atoi(val), wsel);
|
||||
}
|
||||
if ((val = apr_table_get(params, "w_status_S"))) {
|
||||
ap_proxy_set_wstatus(PROXY_WORKER_STOPPED_FLAG, atoi(val), wsel);
|
||||
}
|
||||
if ((val = apr_table_get(params, "w_status_C"))) {
|
||||
ap_proxy_set_wstatus(PROXY_WORKER_HC_FAIL_FLAG, atoi(val), wsel);
|
||||
}
|
||||
if ((val = apr_table_get(params, "w_ls"))) {
|
||||
int ival = atoi(val);
|
||||
if (ival >= 0 && ival <= 99) {
|
||||
|
@@ -135,7 +135,7 @@ static const char *set_worker_hc_param(apr_pool_t *p,
|
||||
return apr_psprintf(p, "Unknown ProxyHCTemplate name: %s", val);
|
||||
}
|
||||
else if (!strcasecmp(key, "hcmethod")) {
|
||||
hcmethods_t *method = hcmethods;
|
||||
proxy_hcmethods_t *method = proxy_hcmethods;
|
||||
for (; method->name; method++) {
|
||||
if (!ap_casecmpstr(val, method->name)) {
|
||||
if (!method->implemented) {
|
||||
|
@@ -54,25 +54,6 @@ typedef struct {
|
||||
const char *proxy_auth; /* Proxy authorization */
|
||||
} forward_info;
|
||||
|
||||
static struct proxy_wstat {
|
||||
unsigned int bit;
|
||||
char flag;
|
||||
const char *name;
|
||||
} proxy_wstat_tbl[] = {
|
||||
{PROXY_WORKER_INITIALIZED, PROXY_WORKER_INITIALIZED_FLAG, "Init "},
|
||||
{PROXY_WORKER_IGNORE_ERRORS, PROXY_WORKER_IGNORE_ERRORS_FLAG, "Ign "},
|
||||
{PROXY_WORKER_DRAIN, PROXY_WORKER_DRAIN_FLAG, "Drn "},
|
||||
{PROXY_WORKER_GENERIC, PROXY_WORKER_GENERIC_FLAG, "Gen "},
|
||||
{PROXY_WORKER_IN_SHUTDOWN, PROXY_WORKER_IN_SHUTDOWN_FLAG, "Shut "},
|
||||
{PROXY_WORKER_DISABLED, PROXY_WORKER_DISABLED_FLAG, "Dis "},
|
||||
{PROXY_WORKER_STOPPED, PROXY_WORKER_STOPPED_FLAG, "Stop "},
|
||||
{PROXY_WORKER_IN_ERROR, PROXY_WORKER_IN_ERROR_FLAG, "Err "},
|
||||
{PROXY_WORKER_HOT_STANDBY, PROXY_WORKER_HOT_STANDBY_FLAG, "Stby "},
|
||||
{PROXY_WORKER_FREE, PROXY_WORKER_FREE_FLAG, "Free "},
|
||||
{PROXY_WORKER_HC_FAIL, PROXY_WORKER_HC_FAIL_FLAG, "HcFl "},
|
||||
{0x0, '\0', NULL}
|
||||
};
|
||||
|
||||
/* Global balancer counter */
|
||||
int PROXY_DECLARE_DATA proxy_lb_workers = 0;
|
||||
static int lb_workers_limit = 0;
|
||||
@@ -3130,7 +3111,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(char c, int set, proxy_worker *
|
||||
{
|
||||
unsigned int *status = &w->s->status;
|
||||
char flag = toupper(c);
|
||||
struct proxy_wstat *pwt = proxy_wstat_tbl;
|
||||
proxy_wstat_t *pwt = proxy_wstat_tbl;
|
||||
while (pwt->bit) {
|
||||
if (flag == pwt->flag) {
|
||||
if (set)
|
||||
@@ -3148,7 +3129,7 @@ PROXY_DECLARE(char *) ap_proxy_parse_wstatus(apr_pool_t *p, proxy_worker *w)
|
||||
{
|
||||
char *ret = "";
|
||||
unsigned int status = w->s->status;
|
||||
struct proxy_wstat *pwt = proxy_wstat_tbl;
|
||||
proxy_wstat_t *pwt = proxy_wstat_tbl;
|
||||
while (pwt->bit) {
|
||||
if (status & pwt->bit)
|
||||
ret = apr_pstrcat(p, ret, pwt->name, NULL);
|
||||
@@ -3701,7 +3682,7 @@ PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme)
|
||||
|
||||
PROXY_DECLARE (const char *) ap_proxy_show_hcmethod(hcmethod_t method)
|
||||
{
|
||||
hcmethods_t *m = hcmethods;
|
||||
proxy_hcmethods_t *m = proxy_hcmethods;
|
||||
for (; m->name; m++) {
|
||||
if (m->method == method) {
|
||||
return m->name;
|
||||
|
Reference in New Issue
Block a user