Open up hook/scar to allow for passes/fails and
authorJim Jagielski <jim@apache.org>
Tue, 19 Jan 2016 12:49:56 +0000 (12:49 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 19 Jan 2016 12:49:56 +0000 (12:49 +0000)
method to be changed via bal-man...

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725498 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_balancer.c
modules/proxy/mod_proxy_hcheck.c

index d24fe6935ee41b9a33b1c0cbf5f1bed1f8da79a8..7de92984bc885c861df4e4cabb1f5ca43f3e6e9a 100644 (file)
@@ -1559,8 +1559,8 @@ static int balancer_handler(request_rec *r)
                 if (set_worker_hc_param_f) {
                     ap_rprintf(r, "</td><td>%s</td>", ap_proxy_show_hcmethod(worker->s->method));
                     ap_rprintf(r, "<td>%d</td>", (int)apr_time_sec(worker->s->interval));
-                    ap_rprintf(r, "<td>%d</td>", worker->s->passes);
-                    ap_rprintf(r, "<td>%d</td>", worker->s->fails);
+                    ap_rprintf(r, "<td>%d (%d)</td>", worker->s->passes,worker->s->pcount);
+                    ap_rprintf(r, "<td>%d (%d)</td>", worker->s->fails, worker->s->fcount);
                     ap_rprintf(r, "<td>%s", worker->s->hcuri);
                 }
                 ap_rputs("</td></tr>\n", r);
index fa755b8d80d380f76bc6b219191ac3b6e643e1b5..9687c771e596465d343e66cf82a87e1a0516ee34 100644 (file)
@@ -48,9 +48,11 @@ typedef struct {
     server_rec *s;
 } sctx_t;
 
+/* Used in the HC worker via the context field */
 typedef struct {
-    char *path;
-    char *req;
+    char *path;      /* The path of the original worker URL */
+    char *req;       /* pre-formatted HTTP/AJP request */
+    proxy_worker *w; /* Pointer to the actual worker */
 } wctx_t;
 
 static void *hc_create_config(apr_pool_t *p, server_rec *s)
@@ -366,14 +368,21 @@ static proxy_worker *hc_get_hcworker(sctx_t *ctx, proxy_worker *worker,
         /* tuck away since we need the preparsed address */
         hc->cp->addr = worker->cp->addr;
         hc->s->method = worker->s->method;
-
         rv = apr_uri_parse(p, url, &uri);
         if (rv == APR_SUCCESS) {
             wctx->path = apr_pstrdup(ctx->p, uri.path);
         }
+        wctx->w = worker;
         hc->context = wctx;
         apr_hash_set(ctx->hcworkers, wptr, APR_HASH_KEY_STRING, hc);
     }
+    /* This *could* have changed via the Balancer Manager */
+    if (hc->s->method != worker->s->method) {
+        wctx_t *wctx = hc->s->context;
+        hc->s->method = worker->s->method;
+        wctx->req = NULL;
+        apr_hash_set(ctx->hcworkers, wptr, APR_HASH_KEY_STRING, hc);
+    }
     return hc;
 }