mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Avoid the overhead of creating and grabbing a uuid for
the balancer nonce if we're never going to use it. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1383490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,6 +1,9 @@
|
|||||||
-*- coding: utf-8 -*-
|
-*- coding: utf-8 -*-
|
||||||
Changes with Apache 2.5.0
|
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
|
*) mod_lua: Add LuaInputFilter/LuaOutputFilter for creating content
|
||||||
filters in Lua [Daniel Gruno]
|
filters in Lua [Daniel Gruno]
|
||||||
|
|
||||||
|
@@ -1109,6 +1109,8 @@ PROXY_DECLARE(char *) ap_proxy_update_balancer(apr_pool_t *p,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PROXY_UNSET_NONCE '\n'
|
||||||
|
|
||||||
PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||||
proxy_balancer **balancer,
|
proxy_balancer **balancer,
|
||||||
proxy_server_conf *conf,
|
proxy_server_conf *conf,
|
||||||
@@ -1116,9 +1118,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
|||||||
const char *alias,
|
const char *alias,
|
||||||
int do_malloc)
|
int do_malloc)
|
||||||
{
|
{
|
||||||
char nonce[APR_UUID_FORMATTED_LENGTH + 1];
|
|
||||||
proxy_balancer_method *lbmethod;
|
proxy_balancer_method *lbmethod;
|
||||||
apr_uuid_t uuid;
|
|
||||||
proxy_balancer_shared *bshared;
|
proxy_balancer_shared *bshared;
|
||||||
char *c, *q, *uri = apr_pstrdup(p, url);
|
char *c, *q, *uri = apr_pstrdup(p, url);
|
||||||
const char *sname;
|
const char *sname;
|
||||||
@@ -1173,14 +1173,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
|||||||
(*balancer)->hash = bshared->hash;
|
(*balancer)->hash = bshared->hash;
|
||||||
|
|
||||||
bshared->forcerecovery = 1;
|
bshared->forcerecovery = 1;
|
||||||
|
*bshared->nonce = PROXY_UNSET_NONCE; /* impossible valid input */
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
(*balancer)->s = bshared;
|
(*balancer)->s = bshared;
|
||||||
(*balancer)->sconf = conf;
|
(*balancer)->sconf = conf;
|
||||||
@@ -1195,6 +1188,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_share_balancer(proxy_balancer *balancer,
|
|||||||
proxy_balancer_shared *shm,
|
proxy_balancer_shared *shm,
|
||||||
int i)
|
int i)
|
||||||
{
|
{
|
||||||
|
apr_status_t rv = APR_SUCCESS;
|
||||||
proxy_balancer_method *lbmethod;
|
proxy_balancer_method *lbmethod;
|
||||||
if (!shm || !balancer->s)
|
if (!shm || !balancer->s)
|
||||||
return APR_EINVAL;
|
return APR_EINVAL;
|
||||||
@@ -1208,7 +1202,18 @@ PROXY_DECLARE(apr_status_t) ap_proxy_share_balancer(proxy_balancer *balancer,
|
|||||||
lbmethod = ap_lookup_provider(PROXY_LBMETHOD, balancer->s->lbpname, "0");
|
lbmethod = ap_lookup_provider(PROXY_LBMETHOD, balancer->s->lbpname, "0");
|
||||||
if (lbmethod)
|
if (lbmethod)
|
||||||
balancer->lbmethod = 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)
|
PROXY_DECLARE(apr_status_t) ap_proxy_initialize_balancer(proxy_balancer *balancer, server_rec *s, apr_pool_t *p)
|
||||||
|
Reference in New Issue
Block a user