You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2012/09/21 17:12:07 UTC

svn commit: r1388549 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS modules/proxy/proxy_util.c

Author: jim
Date: Fri Sep 21 15:12:07 2012
New Revision: 1388549

URL: http://svn.apache.org/viewvc?rev=1388549&view=rev
Log:
Merge r1383490 from trunk:

Avoid the overhead of creating and grabbing a uuid for
the balancer nonce if we're never going to use it.
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1383490

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1388549&r1=1388548&r2=1388549&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Fri Sep 21 15:12:07 2012
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.4
 
+  *) mod_proxy_balancer: The nonce is only derived from the UUID iff
+     not set via the 'nonce' balancer param. [Jim Jagielski]
+
   *) mod_ssl: Match wildcard SSL certificate names in proxy mode.  
      PR 53006.  [Joe Orton]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1388549&r1=1388548&r2=1388549&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Fri Sep 21 15:12:07 2012
@@ -89,11 +89,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_proxy: Obtain UUID for balancer manager nonce only if we're using the
-     default and as late as possible.
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1383490
-     2.4.x patch: trunk patch works (minus CHANGES and w/ fuzz)
-     +1: jim, covener, druggeri
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1388549&r1=1388548&r2=1388549&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Fri Sep 21 15:12:07 2012
@@ -1116,6 +1116,8 @@ PROXY_DECLARE(char *) ap_proxy_update_ba
     return NULL;
 }
 
+#define PROXY_UNSET_NONCE '\n'
+
 PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
                                                proxy_balancer **balancer,
                                                proxy_server_conf *conf,
@@ -1123,9 +1125,7 @@ PROXY_DECLARE(char *) ap_proxy_define_ba
                                                const char *alias,
                                                int do_malloc)
 {
-    char nonce[APR_UUID_FORMATTED_LENGTH + 1];
     proxy_balancer_method *lbmethod;
-    apr_uuid_t uuid;
     proxy_balancer_shared *bshared;
     char *c, *q, *uri = apr_pstrdup(p, url);
     const char *sname;
@@ -1180,14 +1180,7 @@ PROXY_DECLARE(char *) ap_proxy_define_ba
     (*balancer)->hash = bshared->hash;
 
     bshared->forcerecovery = 1;
-
-    /* Retrieve a UUID and store the nonce for the lifetime of
-     * the process. */
-    apr_uuid_get(&uuid);
-    apr_uuid_format(nonce, &uuid);
-    if (PROXY_STRNCPY(bshared->nonce, nonce) != APR_SUCCESS) {
-        return apr_psprintf(p, "balancer nonce (%s) too long", nonce);
-    }
+    *bshared->nonce = PROXY_UNSET_NONCE;  /* impossible valid input */
 
     (*balancer)->s = bshared;
     (*balancer)->sconf = conf;
@@ -1202,6 +1195,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sha
                                                     proxy_balancer_shared *shm,
                                                     int i)
 {
+    apr_status_t rv = APR_SUCCESS;
     proxy_balancer_method *lbmethod;
     if (!shm || !balancer->s)
         return APR_EINVAL;
@@ -1215,7 +1209,18 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sha
     lbmethod = ap_lookup_provider(PROXY_LBMETHOD, balancer->s->lbpname, "0");
     if (lbmethod)
         balancer->lbmethod = lbmethod;
-    return APR_SUCCESS;
+
+    if (*balancer->s->nonce == PROXY_UNSET_NONCE) {
+        char nonce[APR_UUID_FORMATTED_LENGTH + 1];
+        apr_uuid_t uuid;
+        /* Retrieve a UUID and store the nonce for the lifetime of
+         * the process.
+         */
+        apr_uuid_get(&uuid);
+        apr_uuid_format(nonce, &uuid);
+        rv = PROXY_STRNCPY(balancer->s->nonce, nonce);
+    }
+    return rv;
 }
 
 PROXY_DECLARE(apr_status_t) ap_proxy_initialize_balancer(proxy_balancer *balancer, server_rec *s, apr_pool_t *p)