]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Since these are externs, prepend proxy_
authorJim Jagielski <jim@apache.org>
Tue, 2 Feb 2016 15:21:38 +0000 (15:21 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 2 Feb 2016 15:21:38 +0000 (15:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1728148 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_balancer.c
modules/proxy/mod_proxy_hcheck.c
modules/proxy/proxy_util.c

index 5126a14d0c3bc8b9c54a1dcca7d6547c4bd268b3..26a279feba1aefe670e1134bd3d0e8a07b968e6a 100644 (file)
@@ -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;
 
index c8817bd32e16978e860ad44ba7e6d4d0c9f3187a..ea8eeea6b733b905a1482fe1ef415ea5ad3f171f 100644 (file)
@@ -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
index 1e2804250e705bc7795643126dfafa4240e9a2ab..066a0d9258520ce481f539f1eb1597794341e55b 100644 (file)
@@ -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) {
index b1bdc1c946cad8c466fb058eca0e9ccbae39eb4c..90105e3ed85f5553a3b67267e9bc0ebb2184a1dd 100644 (file)
@@ -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) {
index 5165f2637d3c4037fdff71462e02c721d5c56edf..c6b03fd3f76db3a1e2e682ff4a7dccffbbf56de3 100644 (file)
@@ -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;