mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Use identifying server_rec info when we know we have
unique and useful data :) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1387444 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1129,7 +1129,6 @@ cleanup:
|
||||
|
||||
static void * create_proxy_config(apr_pool_t *p, server_rec *s)
|
||||
{
|
||||
unsigned int id;
|
||||
proxy_server_conf *ps = apr_pcalloc(p, sizeof(proxy_server_conf));
|
||||
|
||||
ps->sec_proxy = apr_array_make(p, 10, sizeof(ap_conf_vector_t *));
|
||||
@@ -1142,16 +1141,7 @@ static void * create_proxy_config(apr_pool_t *p, server_rec *s)
|
||||
ps->forward = NULL;
|
||||
ps->reverse = NULL;
|
||||
ps->domain = NULL;
|
||||
/* yeah, ugly, but we need this both unique but consistent */
|
||||
id = ap_proxy_hashfunc(apr_psprintf(p, "%s.%s.%d.%s.%s.%s",
|
||||
(s->server_scheme ? s->server_scheme : "????"),
|
||||
(s->server_hostname ? s->server_hostname : "???"),
|
||||
(int)s->port,
|
||||
(s->server_admin ? s->server_admin : "??"),
|
||||
(s->defn_name ? s->defn_name : "?"),
|
||||
(s->error_fname ? s->error_fname : DEFAULT_ERRORLOG))
|
||||
, PROXY_HASHFUNC_DEFAULT);
|
||||
ps->id = apr_psprintf(p, "p%x", id);
|
||||
ps->id = apr_psprintf(p, "p%x", 1); /* simply for storage size */
|
||||
ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
|
||||
ps->viaopt_set = 0; /* 0 means default */
|
||||
ps->req = 0;
|
||||
@@ -1202,7 +1192,7 @@ static void * merge_proxy_config(apr_pool_t *p, void *basev, void *overridesv)
|
||||
ps->bgrowth = (overrides->bgrowth_set == 0) ? base->bgrowth : overrides->bgrowth;
|
||||
ps->bgrowth_set = overrides->bgrowth_set || base->bgrowth_set;
|
||||
ps->max_balancers = overrides->max_balancers || base->max_balancers;
|
||||
ps->bal_persist = overrides->bal_persist || base->bal_persist;
|
||||
ps->bal_persist = overrides->bal_persist;
|
||||
ps->recv_buffer_size = (overrides->recv_buffer_size_set == 0) ? base->recv_buffer_size : overrides->recv_buffer_size;
|
||||
ps->recv_buffer_size_set = overrides->recv_buffer_size_set || base->recv_buffer_size_set;
|
||||
ps->io_buffer_size = (overrides->io_buffer_size_set == 0) ? base->io_buffer_size : overrides->io_buffer_size;
|
||||
|
@@ -743,11 +743,25 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
*/
|
||||
while (s) {
|
||||
int i,j;
|
||||
char *id;
|
||||
proxy_balancer *balancer;
|
||||
ap_slotmem_type_t type;
|
||||
sconf = s->module_config;
|
||||
conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
|
||||
|
||||
/*
|
||||
* During create_proxy_config() we created a dummy id. Now that
|
||||
* we have identifying info, we can create the real id
|
||||
*/
|
||||
id = apr_psprintf(pconf, "%s.%s.%d.%s.%s.%u.%s",
|
||||
(s->server_scheme ? s->server_scheme : "????"),
|
||||
(s->server_hostname ? s->server_hostname : "???"),
|
||||
(int)s->port,
|
||||
(s->server_admin ? s->server_admin : "??"),
|
||||
(s->defn_name ? s->defn_name : "?"),
|
||||
s->defn_line_number,
|
||||
(s->error_fname ? s->error_fname : DEFAULT_ERRORLOG));
|
||||
conf->id = apr_psprintf(pconf, "p%x",
|
||||
ap_proxy_hashfunc(id, PROXY_HASHFUNC_DEFAULT));
|
||||
if (conf->bslot) {
|
||||
/* Shared memory already created for this proxy_server_conf.
|
||||
*/
|
||||
@@ -782,6 +796,13 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
proxy_worker **workers;
|
||||
proxy_worker *worker;
|
||||
proxy_balancer_shared *bshm;
|
||||
const char *sname;
|
||||
|
||||
/* now that we have the right id, we need to redo the sname field */
|
||||
ap_pstr2_alnum(pconf, balancer->s->name + sizeof(BALANCER_PREFIX) - 1,
|
||||
&sname);
|
||||
sname = apr_pstrcat(pconf, conf->id, "_", sname, NULL);
|
||||
PROXY_STRNCPY(balancer->s->sname, sname); /* We know this will succeed */
|
||||
|
||||
balancer->max_workers = balancer->workers->nelts + balancer->growth;
|
||||
|
||||
|
@@ -1167,6 +1167,10 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||
if (PROXY_STRNCPY(bshared->name, uri) != APR_SUCCESS) {
|
||||
return apr_psprintf(p, "balancer name (%s) too long", uri);
|
||||
}
|
||||
/*
|
||||
* We do the below for verification. The real sname will be
|
||||
* done post_config
|
||||
*/
|
||||
ap_pstr2_alnum(p, bshared->name + sizeof(BALANCER_PREFIX) - 1,
|
||||
&sname);
|
||||
sname = apr_pstrcat(p, conf->id, "_", sname, NULL);
|
||||
|
Reference in New Issue
Block a user