]> granicus.if.org Git - apache/blobdiff - modules/proxy/mod_proxy.c
Close PR 32459, 15207. API change for PROXY_DECLARE ap_proxy_canonenc()
[apache] / modules / proxy / mod_proxy.c
index e2fcb78f19b216299be7e48d106a75fdd6b97143..15372beb7b80ffe9cacd5c87508d61030dd7d99c 100644 (file)
@@ -1,4 +1,3 @@
-#define FIX_15207
 /* Copyright 1999-2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -91,8 +90,8 @@ static const char *set_worker_param(apr_pool_t *p,
 
     int ival;
     if (!strcasecmp(key, "loadfactor")) {
-        /* Worker load factor. Used with BalancerMamber
-         * It is a number between 1 and 100 in percents.
+        /* Normalized load factor. Used with BalancerMamber,
+         * it is a number between 1 and 100.
          */
         worker->lbfactor = atoi(val);
         if (worker->lbfactor < 1 || worker->lbfactor > 100)
@@ -253,6 +252,15 @@ static const char *set_balancer_param(apr_pool_t *p,
         balancer->max_attempts = ival;
         balancer->max_attempts_set = 1;
     }
+    else if (!strcasecmp(key, "lbmethod")) {
+        /* Which LB scheduler method */
+        if (!strcasecmp(val, "traffic"))
+            balancer->lbmethod = lbmethod_traffic;
+        else if (!strcasecmp(val, "requests"))
+            balancer->lbmethod = lbmethod_requests;
+        else
+            return "lbmethod must be Traffic|Requests";
+    }
     else {
         return "unknown Balancer parameter";
     }
@@ -358,7 +366,7 @@ static int proxy_detect(request_rec *r)
     if (conf->req && r->parsed_uri.scheme) {
         /* but it might be something vhosted */
         if (!(r->parsed_uri.hostname
-              && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))
+              && !strcasecmp(r->parsed_uri.scheme, ap_http_scheme(r))
               && ap_matches_request_vhost(r, r->parsed_uri.hostname,
                                           (apr_port_t)(r->parsed_uri.port_str ? r->parsed_uri.port 
                                                        : ap_default_port(r))))) {
@@ -382,6 +390,9 @@ static int proxy_detect(request_rec *r)
         for (i = 0; i < conf->aliases->nelts; i++) {
             len = alias_match(r->unparsed_uri, ent[i].fake);
             if (len > 0) {
+                if ((ent[i].real[0] == '!') && (ent[i].real[1] == 0)) {
+                    return DECLINED;
+                }
                 r->filename = apr_pstrcat(r->pool, "proxy:", ent[i].real,
                                           r->unparsed_uri + len, NULL);
                 r->handler = "proxy-server";
@@ -970,6 +981,8 @@ static const char *
     new = apr_array_push(conf->aliases);
     new->fake = apr_pstrdup(cmd->pool, f);
     new->real = apr_pstrdup(cmd->pool, r);
+    if (r[0] == '!' && r[1] == '\0')
+        return NULL;
     
     arr = apr_table_elts(params);
     elts = (const apr_table_entry_t *)arr->elts;
@@ -1695,11 +1708,15 @@ static int proxy_status_hook(request_rec *r, int flags)
         ap_rputs("<hr />\n<h1>Proxy LoadBalancer Status for ", r);
         ap_rvputs(r, balancer->name, "</h1>\n\n", NULL);
         ap_rputs("\n\n<table border=\"0\"><tr>"
-                 "<th>SSes</th><th>Timeout</th>"
+                 "<th>SSes</th><th>Timeout</th><th>Method</th>"
                  "</tr>\n<tr>", r);                
         ap_rvputs(r, "<td>", balancer->sticky, NULL);
-        ap_rprintf(r, "</td><td>%" APR_TIME_T_FMT "</td>\n",
+        ap_rprintf(r, "</td><td>%" APR_TIME_T_FMT "</td>",
                    apr_time_sec(balancer->timeout));
+        ap_rprintf(r, "<td>%s</td>\n",
+                   balancer->lbmethod == lbmethod_requests ? "Requests" :
+                   balancer->lbmethod == lbmethod_traffic ? "Traffic" :
+                   "Unknown");
         ap_rputs("</table>\n", r);
         ap_rputs("\n\n<table border=\"0\"><tr>"
                  "<th>Sch</th><th>Host</th><th>Stat</th>"
@@ -1724,7 +1741,7 @@ static int proxy_status_hook(request_rec *r, int flags)
             ap_rvputs(r, "</td><td>", worker->s->redirect, NULL);
             ap_rprintf(r, "</td><td>%d</td>", worker->s->lbfactor);
             ap_rprintf(r, "<td>%d</td><td>", (int)(worker->s->elected));
-            ap_rputs(apr_strfsize(worker->s->transfered, fbuf), r);
+            ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r);
             ap_rputs("</td><td>", r);
             ap_rputs(apr_strfsize(worker->s->read, fbuf), r);
             ap_rputs("</td>\n", r);
@@ -1747,7 +1764,7 @@ static int proxy_status_hook(request_rec *r, int flags)
              "<tr><th>Redir</th><td>Session Route Redirection</td></tr>\n"
              "<tr><th>F</th><td>Load Balancer Factor in %</td></tr>\n"
              "<tr><th>Acc</th><td>Number of requests</td></tr>\n"
-             "<tr><th>Wr</th><td>Number of bytes transfered</td></tr>\n"
+             "<tr><th>Wr</th><td>Number of bytes transferred</td></tr>\n"
              "<tr><th>Rd</th><td>Number of bytes read</td></tr>\n"
              "</table>", r);