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/11 19:39:33 UTC
svn commit: r1383490 - in /httpd/httpd/trunk: CHANGES
modules/proxy/proxy_util.c
Author: jim
Date: Tue Sep 11 17:39:32 2012
New Revision: 1383490
URL: http://svn.apache.org/viewvc?rev=1383490&view=rev
Log:
Avoid the overhead of creating and grabbing a uuid for
the balancer nonce if we're never going to use it.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/modules/proxy/proxy_util.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1383490&r1=1383489&r2=1383490&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Sep 11 17:39:32 2012
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) mod_proxy_balancer: The nonce is only derived from the UUID iff
+ not set via the 'nonce' balancer param. [Jim Jagielski]
+
*) mod_lua: Add LuaInputFilter/LuaOutputFilter for creating content
filters in Lua [Daniel Gruno]
Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1383490&r1=1383489&r2=1383490&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue Sep 11 17:39:32 2012
@@ -1109,6 +1109,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,
@@ -1116,9 +1118,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;
@@ -1173,14 +1173,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;
@@ -1195,6 +1188,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;
@@ -1208,7 +1202,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)