mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Ensure that userland format of UDS is the same as how it is
configured, no matter how we store and use it internally. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1531962 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1544,15 +1544,15 @@ static const char *
|
|||||||
} else {
|
} else {
|
||||||
reuse = 1;
|
reuse = 1;
|
||||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, APLOGNO(01145)
|
ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, APLOGNO(01145)
|
||||||
"Sharing worker '%s%s' instead of creating new worker '%s'",
|
"Sharing worker '%s' instead of creating new worker '%s'",
|
||||||
worker->s->name, (worker->s->uds?"|":""), new->real);
|
ap_proxy_worker_name(cmd->pool, worker), new->real);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < arr->nelts; i++) {
|
for (i = 0; i < arr->nelts; i++) {
|
||||||
if (reuse) {
|
if (reuse) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(01146)
|
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(01146)
|
||||||
"Ignoring parameter '%s=%s' for worker '%s%s' because of worker sharing",
|
"Ignoring parameter '%s=%s' for worker '%s' because of worker sharing",
|
||||||
elts[i].key, elts[i].val, worker->s->name, (worker->s->uds?"|":""));
|
elts[i].key, elts[i].val, ap_proxy_worker_name(cmd->pool, worker));
|
||||||
} else {
|
} else {
|
||||||
const char *err = set_worker_param(cmd->pool, worker, elts[i].key,
|
const char *err = set_worker_param(cmd->pool, worker, elts[i].key,
|
||||||
elts[i].val);
|
elts[i].val);
|
||||||
@@ -2017,14 +2017,14 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
|
|||||||
if ((err = ap_proxy_define_worker(cmd->pool, &worker, balancer, conf, name, 0)) != NULL)
|
if ((err = ap_proxy_define_worker(cmd->pool, &worker, balancer, conf, name, 0)) != NULL)
|
||||||
return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL);
|
return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL);
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, APLOGNO(01148)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, APLOGNO(01148)
|
||||||
"Defined worker '%s%s' for balancer '%s'",
|
"Defined worker '%s' for balancer '%s'",
|
||||||
worker->s->name, (worker->s->uds ? "|" : ""), balancer->s->name);
|
ap_proxy_worker_name(cmd->pool, worker), balancer->s->name);
|
||||||
PROXY_COPY_CONF_PARAMS(worker, conf);
|
PROXY_COPY_CONF_PARAMS(worker, conf);
|
||||||
} else {
|
} else {
|
||||||
reuse = 1;
|
reuse = 1;
|
||||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, APLOGNO(01149)
|
ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, APLOGNO(01149)
|
||||||
"Sharing worker '%s%s' instead of creating new worker '%s'",
|
"Sharing worker '%s' instead of creating new worker '%s'",
|
||||||
worker->s->name, (worker->s->uds?"|":""), name);
|
ap_proxy_worker_name(cmd->pool, worker), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
arr = apr_table_elts(params);
|
arr = apr_table_elts(params);
|
||||||
@@ -2032,8 +2032,8 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
|
|||||||
for (i = 0; i < arr->nelts; i++) {
|
for (i = 0; i < arr->nelts; i++) {
|
||||||
if (reuse) {
|
if (reuse) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(01150)
|
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(01150)
|
||||||
"Ignoring parameter '%s=%s' for worker '%s%s' because of worker sharing",
|
"Ignoring parameter '%s=%s' for worker '%s' because of worker sharing",
|
||||||
elts[i].key, elts[i].val, worker->s->name, (worker->s->uds?"|":""));
|
elts[i].key, elts[i].val, ap_proxy_worker_name(cmd->pool, worker));
|
||||||
} else {
|
} else {
|
||||||
err = set_worker_param(cmd->pool, worker, elts[i].key,
|
err = set_worker_param(cmd->pool, worker, elts[i].key,
|
||||||
elts[i].val);
|
elts[i].val);
|
||||||
|
@@ -587,6 +587,16 @@ typedef __declspec(dllimport) const char *
|
|||||||
|
|
||||||
|
|
||||||
/* Connection pool API */
|
/* Connection pool API */
|
||||||
|
/**
|
||||||
|
* Return the user-land, UDS aware worker name
|
||||||
|
* @param p memory pool used for displaying worker name
|
||||||
|
* @param worker the worker
|
||||||
|
* @return name
|
||||||
|
*/
|
||||||
|
|
||||||
|
PROXY_DECLARE(char *) ap_proxy_worker_name(apr_pool_t *p,
|
||||||
|
proxy_worker *worker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the worker from proxy configuration
|
* Get the worker from proxy configuration
|
||||||
* @param p memory pool used for finding worker
|
* @param p memory pool used for finding worker
|
||||||
|
@@ -118,8 +118,8 @@ static void init_balancer_members(apr_pool_t *p, server_rec *s,
|
|||||||
int worker_is_initialized;
|
int worker_is_initialized;
|
||||||
proxy_worker *worker = *workers;
|
proxy_worker *worker = *workers;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01158)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01158)
|
||||||
"Looking at %s -> %s%s initialized?", balancer->s->name, worker->s->name,
|
"Looking at %s -> %s initialized?", balancer->s->name,
|
||||||
(worker->s->uds?"|":""));
|
ap_proxy_worker_name(p, worker));
|
||||||
worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(worker);
|
worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(worker);
|
||||||
if (!worker_is_initialized) {
|
if (!worker_is_initialized) {
|
||||||
ap_proxy_initialize_worker(worker, s, p);
|
ap_proxy_initialize_worker(worker, s, p);
|
||||||
@@ -639,11 +639,11 @@ static int proxy_balancer_post_request(proxy_worker *worker,
|
|||||||
int val = ((int *)balancer->errstatuses->elts)[i];
|
int val = ((int *)balancer->errstatuses->elts)[i];
|
||||||
if (r->status == val) {
|
if (r->status == val) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01174)
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01174)
|
||||||
"%s: Forcing worker (%s%s) into error state "
|
"%s: Forcing worker (%s) into error state "
|
||||||
"due to status code %d matching 'failonstatus' "
|
"due to status code %d matching 'failonstatus' "
|
||||||
"balancer parameter",
|
"balancer parameter",
|
||||||
balancer->s->name, worker->s->name,
|
balancer->s->name, ap_proxy_worker_name(r->pool, worker),
|
||||||
(worker->s->uds?"|":""), val);
|
val);
|
||||||
worker->s->status |= PROXY_WORKER_IN_ERROR;
|
worker->s->status |= PROXY_WORKER_IN_ERROR;
|
||||||
worker->s->error_time = apr_time_now();
|
worker->s->error_time = apr_time_now();
|
||||||
break;
|
break;
|
||||||
@@ -654,9 +654,9 @@ static int proxy_balancer_post_request(proxy_worker *worker,
|
|||||||
if (balancer->failontimeout
|
if (balancer->failontimeout
|
||||||
&& (apr_table_get(r->notes, "proxy_timedout")) != NULL) {
|
&& (apr_table_get(r->notes, "proxy_timedout")) != NULL) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02460)
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02460)
|
||||||
"%s: Forcing worker (%s%s) into error state "
|
"%s: Forcing worker (%s) into error state "
|
||||||
"due to timeout and 'failonstatus' parameter being set",
|
"due to timeout and 'failonstatus' parameter being set",
|
||||||
balancer->s->name, worker->s->name, (worker->s->uds?"|":""));
|
balancer->s->name, ap_proxy_worker_name(r->pool, worker));
|
||||||
worker->s->status |= PROXY_WORKER_IN_ERROR;
|
worker->s->status |= PROXY_WORKER_IN_ERROR;
|
||||||
worker->s->error_time = apr_time_now();
|
worker->s->error_time = apr_time_now();
|
||||||
|
|
||||||
@@ -1284,7 +1284,7 @@ static int balancer_handler(request_rec *r)
|
|||||||
worker = *workers;
|
worker = *workers;
|
||||||
/* Start proxy_worker */
|
/* Start proxy_worker */
|
||||||
ap_rputs(" <httpd:worker>\n", r);
|
ap_rputs(" <httpd:worker>\n", r);
|
||||||
ap_rvputs(r, " <httpd:name>", worker->s->name, (worker->s->uds?"|":""),
|
ap_rvputs(r, " <httpd:name>", ap_proxy_worker_name(r->pool, worker),
|
||||||
"</httpd:name>\n", NULL);
|
"</httpd:name>\n", NULL);
|
||||||
ap_rvputs(r, " <httpd:scheme>", worker->s->scheme,
|
ap_rvputs(r, " <httpd:scheme>", worker->s->scheme,
|
||||||
"</httpd:scheme>\n", NULL);
|
"</httpd:scheme>\n", NULL);
|
||||||
@@ -1533,8 +1533,8 @@ static int balancer_handler(request_rec *r)
|
|||||||
ap_escape_uri(r->pool, worker->s->name),
|
ap_escape_uri(r->pool, worker->s->name),
|
||||||
"&nonce=", balancer->s->nonce,
|
"&nonce=", balancer->s->nonce,
|
||||||
"\">", NULL);
|
"\">", NULL);
|
||||||
ap_rvputs(r, (worker->s->uds ? "<i>" : ""), worker->s->name,
|
ap_rvputs(r, (worker->s->uds ? "<i>" : ""), ap_proxy_worker_name(r->pool, worker),
|
||||||
(worker->s->uds ? "|</i>" : ""), "</a></td>", NULL);
|
(worker->s->uds ? "</i>" : ""), "</a></td>", NULL);
|
||||||
ap_rvputs(r, "<td>", ap_escape_html(r->pool, worker->s->route),
|
ap_rvputs(r, "<td>", ap_escape_html(r->pool, worker->s->route),
|
||||||
NULL);
|
NULL);
|
||||||
ap_rvputs(r, "</td><td>",
|
ap_rvputs(r, "</td><td>",
|
||||||
@@ -1559,7 +1559,7 @@ static int balancer_handler(request_rec *r)
|
|||||||
ap_rputs("<hr />\n", r);
|
ap_rputs("<hr />\n", r);
|
||||||
if (wsel && bsel) {
|
if (wsel && bsel) {
|
||||||
ap_rputs("<h3>Edit worker settings for ", r);
|
ap_rputs("<h3>Edit worker settings for ", r);
|
||||||
ap_rvputs(r, (wsel->s->uds?"<i>":""), wsel->s->name, (wsel->s->uds?"|</i>":""), "</h3>\n", NULL);
|
ap_rvputs(r, (wsel->s->uds?"<i>":""), ap_proxy_worker_name(r->pool, wsel), (wsel->s->uds?"</i>":""), "</h3>\n", NULL);
|
||||||
ap_rputs("<form method=\"POST\" enctype=\"application/x-www-form-urlencoded\" action=\"", r);
|
ap_rputs("<form method=\"POST\" enctype=\"application/x-www-form-urlencoded\" action=\"", r);
|
||||||
ap_rvputs(r, ap_escape_uri(r->pool, action), "\">\n", NULL);
|
ap_rvputs(r, ap_escape_uri(r->pool, action), "\">\n", NULL);
|
||||||
ap_rputs("<dl>\n<table><tr><td>Load factor:</td><td><input name='w_lf' id='w_lf' type=text ", r);
|
ap_rputs("<dl>\n<table><tr><td>Load factor:</td><td><input name='w_lf' id='w_lf' type=text ", r);
|
||||||
|
@@ -1361,9 +1361,9 @@ static apr_status_t connection_cleanup(void *theconn)
|
|||||||
/* Sanity check: Did we already return the pooled connection? */
|
/* Sanity check: Did we already return the pooled connection? */
|
||||||
if (conn->inreslist) {
|
if (conn->inreslist) {
|
||||||
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool, APLOGNO(00923)
|
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool, APLOGNO(00923)
|
||||||
"Pooled connection 0x%pp for worker %s%s has been"
|
"Pooled connection 0x%pp for worker %s has been"
|
||||||
" already returned to the connection pool.", conn,
|
" already returned to the connection pool.", conn,
|
||||||
worker->s->name, (worker->s->uds?"|":""));
|
ap_proxy_worker_name(conn->pool, worker));
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1487,6 +1487,26 @@ static apr_status_t connection_destructor(void *resource, void *params,
|
|||||||
* WORKER related...
|
* WORKER related...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
PROXY_DECLARE(char *) ap_proxy_worker_name(apr_pool_t *p,
|
||||||
|
proxy_worker *worker)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
apr_uri_t uri;
|
||||||
|
apr_pool_t *pool = p;
|
||||||
|
if (!worker->s->uds) {
|
||||||
|
return worker->s->name;
|
||||||
|
}
|
||||||
|
if (!pool) {
|
||||||
|
/* ugly */
|
||||||
|
apr_pool_create(&pool, ap_server_conf->process->pool);
|
||||||
|
}
|
||||||
|
rv = apr_uri_parse(pool, worker->s->name, &uri);
|
||||||
|
if (rv != APR_SUCCESS) {
|
||||||
|
return apr_pstrcat(pool, worker->s->name, "|", NULL);
|
||||||
|
}
|
||||||
|
return apr_pstrcat(pool, uri.scheme, "://localhost/|sock:", uri.path, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||||
proxy_balancer *balancer,
|
proxy_balancer *balancer,
|
||||||
proxy_server_conf *conf,
|
proxy_server_conf *conf,
|
||||||
@@ -1707,8 +1727,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_share_worker(proxy_worker *worker, proxy_wo
|
|||||||
action = "re-using";
|
action = "re-using";
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(02338)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(02338)
|
||||||
"%s shm[%d] (0x%pp) for worker: %s%s", action, i, (void *)shm,
|
"%s shm[%d] (0x%pp) for worker: %s", action, i, (void *)shm,
|
||||||
worker->s->name, (worker->s->uds?"|":""));
|
ap_proxy_worker_name(NULL, worker));
|
||||||
|
|
||||||
worker->s = shm;
|
worker->s = shm;
|
||||||
worker->s->index = i;
|
worker->s->index = i;
|
||||||
@@ -1723,13 +1743,13 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
if (worker->s->status & PROXY_WORKER_INITIALIZED) {
|
if (worker->s->status & PROXY_WORKER_INITIALIZED) {
|
||||||
/* The worker is already initialized */
|
/* The worker is already initialized */
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00924)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00924)
|
||||||
"worker %s%s shared already initialized", worker->s->name,
|
"worker %s shared already initialized",
|
||||||
(worker->s->uds?"|":""));
|
ap_proxy_worker_name(p, worker));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00925)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00925)
|
||||||
"initializing worker %s%s shared", worker->s->name,
|
"initializing worker %s shared",
|
||||||
(worker->s->uds?"|":""));
|
ap_proxy_worker_name(p, worker));
|
||||||
/* Set default parameters */
|
/* Set default parameters */
|
||||||
if (!worker->s->retry_set) {
|
if (!worker->s->retry_set) {
|
||||||
worker->s->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
|
worker->s->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
|
||||||
@@ -1765,13 +1785,13 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
/* What if local is init'ed and shm isn't?? Even possible? */
|
/* What if local is init'ed and shm isn't?? Even possible? */
|
||||||
if (worker->local_status & PROXY_WORKER_INITIALIZED) {
|
if (worker->local_status & PROXY_WORKER_INITIALIZED) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00926)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00926)
|
||||||
"worker %s%s local already initialized", worker->s->name,
|
"worker %s local already initialized",
|
||||||
(worker->s->uds?"|":""));
|
ap_proxy_worker_name(p, worker));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00927)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00927)
|
||||||
"initializing worker %s%s local", worker->s->name,
|
"initializing worker %s local",
|
||||||
(worker->s->uds?"|":""));
|
ap_proxy_worker_name(p, worker));
|
||||||
apr_global_mutex_lock(proxy_mutex);
|
apr_global_mutex_lock(proxy_mutex);
|
||||||
/* Now init local worker data */
|
/* Now init local worker data */
|
||||||
if (worker->tmutex == NULL) {
|
if (worker->tmutex == NULL) {
|
||||||
@@ -2927,8 +2947,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b, server_rec
|
|||||||
if (worker->hash.def == shm->hash.def && worker->hash.fnv == shm->hash.fnv) {
|
if (worker->hash.def == shm->hash.def && worker->hash.fnv == shm->hash.fnv) {
|
||||||
found = 1;
|
found = 1;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02402)
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02402)
|
||||||
"re-grabbing shm[%d] (0x%pp) for worker: %s%s", i, (void *)shm,
|
"re-grabbing shm[%d] (0x%pp) for worker: %s", i, (void *)shm,
|
||||||
worker->s->name, (worker->s->uds?"|":""));
|
ap_proxy_worker_name(conf->pool, worker));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user