mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
whitespace
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1058626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -985,7 +985,7 @@ static int proxy_handler(request_rec *r)
|
||||
|
||||
/* Initialise worker if needed, note the shared area must be initialized by the balancer logic */
|
||||
if (balancer) {
|
||||
ap_proxy_initialize_worker(worker, r->server, conf->pool);
|
||||
ap_proxy_initialize_worker(worker, r->server, conf->pool);
|
||||
}
|
||||
|
||||
if (balancer && balancer->max_attempts_set && !max_attempts)
|
||||
@@ -1357,7 +1357,7 @@ static const char *
|
||||
const char *err;
|
||||
|
||||
err = ap_check_cmd_context(cmd, NOT_IN_DIRECTORY|NOT_IN_FILES);
|
||||
if (err) {
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1512,7 +1512,7 @@ static const char * add_pass_reverse(cmd_parms *cmd, void *dconf, const char *f,
|
||||
const char *err;
|
||||
|
||||
err = ap_check_cmd_context(cmd, NOT_IN_DIRECTORY|NOT_IN_FILES);
|
||||
if (err) {
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -2391,7 +2391,7 @@ static void child_init(apr_pool_t *p, server_rec *s)
|
||||
PROXY_STRNCPY(conf->forward->s->name, "proxy:forward");
|
||||
PROXY_STRNCPY(conf->forward->s->hostname, "*");
|
||||
PROXY_STRNCPY(conf->forward->s->scheme, "*");
|
||||
conf->forward->hash = conf->forward->s->hash =
|
||||
conf->forward->hash = conf->forward->s->hash =
|
||||
ap_proxy_hashfunc(conf->forward->s->name, PROXY_HASHFUNC_DEFAULT);
|
||||
/* Do not disable worker in case of errors */
|
||||
conf->forward->s->status |= PROXY_WORKER_IGNORE_ERRORS;
|
||||
@@ -2404,7 +2404,7 @@ static void child_init(apr_pool_t *p, server_rec *s)
|
||||
PROXY_STRNCPY(reverse->s->name, "proxy:reverse");
|
||||
PROXY_STRNCPY(reverse->s->hostname, "*");
|
||||
PROXY_STRNCPY(reverse->s->scheme, "*");
|
||||
reverse->hash = reverse->s->hash =
|
||||
reverse->hash = reverse->s->hash =
|
||||
ap_proxy_hashfunc(reverse->s->name, PROXY_HASHFUNC_DEFAULT);
|
||||
/* Do not disable worker in case of errors */
|
||||
reverse->s->status |= PROXY_WORKER_IGNORE_ERRORS;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#ifndef MOD_PROXY_H
|
||||
#define MOD_PROXY_H
|
||||
#define MOD_PROXY_H
|
||||
|
||||
/**
|
||||
* @file mod_proxy.h
|
||||
@@ -159,7 +159,7 @@ typedef struct {
|
||||
} proxy_status; /* Status display options */
|
||||
apr_sockaddr_t *source_address;
|
||||
apr_global_mutex_t *mutex; /* global lock (needed??) */
|
||||
|
||||
|
||||
int req_set:1;
|
||||
int viaopt_set:1;
|
||||
int recv_buffer_size_set:1;
|
||||
@@ -384,7 +384,7 @@ struct proxy_balancer_method {
|
||||
void *context; /* general purpose storage */
|
||||
apr_status_t (*reset)(proxy_balancer *balancer, server_rec *s);
|
||||
apr_status_t (*age)(proxy_balancer *balancer, server_rec *s);
|
||||
apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker *elected, server_rec *s);
|
||||
apr_status_t (*updatelbstatus)(proxy_balancer *balancer, proxy_worker *elected, server_rec *s);
|
||||
};
|
||||
|
||||
#define PROXY_THREAD_LOCK(x) apr_thread_mutex_lock((x)->mutex)
|
||||
@@ -395,7 +395,7 @@ struct proxy_balancer_method {
|
||||
|
||||
/* hooks */
|
||||
|
||||
/* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and
|
||||
/* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and
|
||||
* PROXY_DECLARE_DATA with appropriate export and import tags for the platform
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
@@ -423,14 +423,14 @@ struct proxy_balancer_method {
|
||||
#define PROXY_OPTIONAL_HOOK(name,fn,pre,succ,order) \
|
||||
APR_OPTIONAL_HOOK(proxy,name,fn,pre,succ,order)
|
||||
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
|
||||
proxy_worker *worker, proxy_server_conf *conf, char *url,
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
|
||||
proxy_worker *worker, proxy_server_conf *conf, char *url,
|
||||
const char *proxyhost, apr_port_t proxyport))
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r,
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r,
|
||||
char *url))
|
||||
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r))
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r))
|
||||
|
||||
/**
|
||||
* pre request hook.
|
||||
@@ -443,7 +443,7 @@ APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r))
|
||||
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, pre_request, (proxy_worker **worker,
|
||||
proxy_balancer **balancer,
|
||||
request_rec *r,
|
||||
proxy_server_conf *conf, char **url))
|
||||
proxy_server_conf *conf, char **url))
|
||||
/**
|
||||
* post request hook.
|
||||
* It is called after request for updating runtime balancer status.
|
||||
@@ -528,7 +528,7 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||
const char *url);
|
||||
/**
|
||||
* Define and Allocate space for the worker to proxy configuration
|
||||
* @param p memory pool to allocate worker from
|
||||
* @param p memory pool to allocate worker from
|
||||
* @param worker the new worker
|
||||
* @param balancer the balancer that the worker belongs to
|
||||
* @param conf current proxy server configuration
|
||||
@@ -543,7 +543,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
|
||||
|
||||
/**
|
||||
* Share a defined proxy worker via shm
|
||||
* @param worker worker to be shared
|
||||
* @param worker worker to be shared
|
||||
* @param shm location of shared info
|
||||
* @param i index into shm
|
||||
* @return APR_SUCCESS or error code
|
||||
@@ -583,7 +583,7 @@ PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
|
||||
|
||||
/**
|
||||
* Define and Allocate space for the balancer to proxy configuration
|
||||
* @param p memory pool to allocate balancer from
|
||||
* @param p memory pool to allocate balancer from
|
||||
* @param balancer the new balancer
|
||||
* @param conf current proxy server configuration
|
||||
* @param url url containing balancer name
|
||||
@@ -601,7 +601,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||
* @param r current request
|
||||
* @param conf current proxy server configuration
|
||||
* @param url request url that balancer can rewrite.
|
||||
* @return OK or HTTP_XXX error
|
||||
* @return OK or HTTP_XXX error
|
||||
* @note It calls balancer pre_request hook if the url starts with balancer://
|
||||
* The balancer then rewrites the url to particular worker, like http://host:port
|
||||
*/
|
||||
@@ -618,7 +618,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
||||
* @param conf current proxy server configuration
|
||||
* @return OK or HTTP_XXX error
|
||||
* @note Whenever the pre_request is called, the post_request has to be
|
||||
* called too.
|
||||
* called too.
|
||||
*/
|
||||
PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker,
|
||||
proxy_balancer *balancer,
|
||||
@@ -647,7 +647,7 @@ PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker,
|
||||
* @param server_portstr Via headers server port
|
||||
* @param server_portstr_size size of the server_portstr buffer
|
||||
* @return OK or HTTP_XXX error
|
||||
*/
|
||||
*/
|
||||
PROXY_DECLARE(int) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
||||
proxy_server_conf *conf,
|
||||
proxy_worker *worker,
|
||||
@@ -694,7 +694,7 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
|
||||
* @param s current server record
|
||||
* @return OK or HTTP_XXX error
|
||||
* @note The connection will be closed if conn->close_on_release is set
|
||||
*/
|
||||
*/
|
||||
PROXY_DECLARE(int) ap_proxy_release_connection(const char *proxy_function,
|
||||
proxy_conn_rec *conn,
|
||||
server_rec *s);
|
||||
@@ -707,7 +707,7 @@ PROXY_DECLARE(int) ap_proxy_release_connection(const char *proxy_function,
|
||||
* @return OK or HTTP_XXX error
|
||||
* @note In case the socket already exists for conn, just check the link
|
||||
* status.
|
||||
*/
|
||||
*/
|
||||
PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
||||
proxy_conn_rec *conn,
|
||||
proxy_worker *worker,
|
||||
|
@@ -35,18 +35,18 @@ static char balancer_nonce[APR_UUID_FORMATTED_LENGTH + 1];
|
||||
* Register our mutex type before the config is read so we
|
||||
* can adjust the mutex settings using the Mutex directive.
|
||||
*/
|
||||
static int balancer_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
static int balancer_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
apr_pool_t *ptemp)
|
||||
{
|
||||
|
||||
apr_status_t rv;
|
||||
|
||||
|
||||
rv = ap_mutex_register(pconf, balancer_mutex_type, NULL,
|
||||
APR_LOCK_DEFAULT, 0);
|
||||
if (rv != APR_SUCCESS) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ static proxy_worker *find_route_worker(proxy_balancer *balancer,
|
||||
int i;
|
||||
int checking_standby;
|
||||
int checked_standby;
|
||||
|
||||
|
||||
proxy_worker **workers;
|
||||
|
||||
checking_standby = checked_standby = 0;
|
||||
@@ -475,7 +475,7 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
|
||||
|
||||
/* Step 3: force recovery */
|
||||
force_recovery(*balancer, r->server);
|
||||
|
||||
|
||||
/* Step 3.5: Update member list for the balancer */
|
||||
/* TODO: Implement as provider! */
|
||||
/* proxy_update_members(balancer, r, conf); */
|
||||
@@ -715,8 +715,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
* the process. */
|
||||
apr_uuid_get(&uuid);
|
||||
apr_uuid_format(balancer_nonce, &uuid);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Get worker slotmem setup
|
||||
*/
|
||||
@@ -736,14 +735,14 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
proxy_balancer *balancer;
|
||||
sconf = s->module_config;
|
||||
conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
|
||||
|
||||
|
||||
/* Initialize shared scoreboard data */
|
||||
balancer = (proxy_balancer *)conf->balancers->elts;
|
||||
for (i = 0; i < conf->balancers->nelts; i++, balancer++) {
|
||||
proxy_worker **workers;
|
||||
proxy_worker *worker;
|
||||
ap_slotmem_instance_t *new = NULL;
|
||||
|
||||
|
||||
balancer->max_workers = balancer->workers->nelts + balancer->growth;
|
||||
balancer->sname = ap_md5(pconf, (const unsigned char *)balancer->name);
|
||||
|
||||
@@ -756,10 +755,10 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
balancer->sname);
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
|
||||
apr_pool_cleanup_register(pconf, (void *)s, lock_remove,
|
||||
apr_pool_cleanup_null);
|
||||
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Doing create: %s (%s), %d, %d",
|
||||
balancer->name, balancer->sname,
|
||||
(int)sizeof(proxy_worker_shared),
|
||||
@@ -782,7 +781,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
if ((rv = storage->grab(balancer->slot, &index)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "slotmem_grab failed");
|
||||
return !OK;
|
||||
|
||||
|
||||
}
|
||||
if ((rv = storage->dptr(balancer->slot, index, (void *)&shm)) != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "slotmem_dptr failed");
|
||||
@@ -796,7 +795,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
}
|
||||
s = s->next;
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -849,11 +848,11 @@ static int balancer_handler(request_rec *r)
|
||||
return HTTP_BAD_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check that the supplied nonce matches this server's nonce;
|
||||
* otherwise ignore all parameters, to prevent a CSRF attack. */
|
||||
if (*balancer_nonce &&
|
||||
((name = apr_table_get(params, "nonce")) == NULL
|
||||
((name = apr_table_get(params, "nonce")) == NULL
|
||||
|| strcmp(balancer_nonce, name) != 0)) {
|
||||
apr_table_clear(params);
|
||||
}
|
||||
@@ -985,7 +984,7 @@ static int balancer_handler(request_rec *r)
|
||||
ap_rvputs(r, "<tr>\n<td><a href=\"", r->uri, "?b=",
|
||||
balancer->name + sizeof(BALANCER_PREFIX) - 1, "&w=",
|
||||
ap_escape_uri(r->pool, worker->s->name),
|
||||
"&nonce=", balancer_nonce,
|
||||
"&nonce=", balancer_nonce,
|
||||
"\">", NULL);
|
||||
ap_rvputs(r, worker->s->name, "</a></td>", NULL);
|
||||
ap_rvputs(r, "<td>", ap_escape_html(r->pool, worker->s->route),
|
||||
@@ -1049,7 +1048,7 @@ static int balancer_handler(request_rec *r)
|
||||
ap_rvputs(r, "<input type=hidden name=\"b\" ", NULL);
|
||||
ap_rvputs(r, "value=\"", bsel->name + sizeof(BALANCER_PREFIX) - 1,
|
||||
"\">\n", NULL);
|
||||
ap_rvputs(r, "<input type=hidden name=\"nonce\" value=\"",
|
||||
ap_rvputs(r, "<input type=hidden name=\"nonce\" value=\"",
|
||||
balancer_nonce, "\">\n", NULL);
|
||||
ap_rvputs(r, "</form>\n", NULL);
|
||||
ap_rputs("<hr />\n", r);
|
||||
@@ -1068,7 +1067,7 @@ static void balancer_child_init(apr_pool_t *p, server_rec *s)
|
||||
void *sconf = s->module_config;
|
||||
proxy_server_conf *conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
|
||||
apr_status_t rv;
|
||||
|
||||
|
||||
balancer = (proxy_balancer *)conf->balancers->elts;
|
||||
for (i = 0; i < conf->balancers->nelts; i++) {
|
||||
apr_size_t size;
|
||||
@@ -1086,15 +1085,15 @@ static void balancer_child_init(apr_pool_t *p, server_rec *s)
|
||||
}
|
||||
|
||||
/* Re-open the mutex for the child. */
|
||||
rv = apr_global_mutex_child_init(&(balancer->mutex),
|
||||
rv = apr_global_mutex_child_init(&(balancer->mutex),
|
||||
apr_global_mutex_lockfile(balancer->mutex),
|
||||
p);
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
|
||||
"Failed to reopen mutex %: %s in child",
|
||||
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
|
||||
"Failed to reopen mutex %: %s in child",
|
||||
balancer->name, balancer_mutex_type);
|
||||
exit(1); /* Ugly, but what else? */
|
||||
}
|
||||
}
|
||||
|
||||
/* now attach */
|
||||
storage->attach(&(balancer->slot), balancer->sname, &size, &num, p);
|
||||
|
@@ -1121,7 +1121,7 @@ PROXY_DECLARE(const char *) ap_proxy_location_reverse_map(request_rec *r,
|
||||
/* urlpart (l3) assuredly starts with its own '/' */
|
||||
if ((*worker)->s->name[l2 - 1] == '/')
|
||||
--l2;
|
||||
if (l1 >= l2 + l3
|
||||
if (l1 >= l2 + l3
|
||||
&& strncasecmp((*worker)->s->name, url, l2) == 0
|
||||
&& strncmp(urlpart, url + l2, l3) == 0) {
|
||||
u = apr_pstrcat(r->pool, ent[i].fake, &url[l2 + l3],
|
||||
@@ -1306,7 +1306,7 @@ PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
|
||||
proxy_balancer *balancer;
|
||||
char *c, *uri = apr_pstrdup(p, url);
|
||||
int i;
|
||||
|
||||
|
||||
c = strchr(uri, ':');
|
||||
if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') {
|
||||
return NULL;
|
||||
@@ -1341,7 +1341,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
|
||||
/* remove path from uri */
|
||||
if ((q = strchr(c + 3, '/')))
|
||||
*q = '\0';
|
||||
|
||||
|
||||
ap_str_tolower(uri);
|
||||
*balancer = apr_array_push(conf->balancers);
|
||||
memset(*balancer, 0, sizeof(proxy_balancer));
|
||||
@@ -1575,15 +1575,15 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||
const char *c;
|
||||
char *url_copy;
|
||||
int i;
|
||||
|
||||
|
||||
c = ap_strchr_c(url, ':');
|
||||
if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
url_copy = apr_pstrdup(p, url);
|
||||
url_length = strlen(url);
|
||||
|
||||
|
||||
/*
|
||||
* We need to find the start of the path and
|
||||
* therefore we know the length of the scheme://hostname/
|
||||
@@ -1609,7 +1609,7 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||
* a minimum matching of length min_match such that
|
||||
* scheme://hostname[:port] matches between worker and url.
|
||||
*/
|
||||
|
||||
|
||||
if (balancer) {
|
||||
proxy_worker **workers = (proxy_worker **)balancer->workers->elts;
|
||||
for (i = 0; i < balancer->workers->nelts; i++, workers++) {
|
||||
@@ -1621,7 +1621,7 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||
max_worker = worker;
|
||||
max_match = worker_name_length;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
worker = (proxy_worker *)conf->workers->elts;
|
||||
@@ -1635,7 +1635,7 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return max_worker;
|
||||
}
|
||||
|
||||
@@ -1655,22 +1655,22 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
|
||||
int rv;
|
||||
apr_uri_t uri;
|
||||
proxy_worker_shared *wstatus;
|
||||
|
||||
|
||||
rv = apr_uri_parse(p, url, &uri);
|
||||
|
||||
|
||||
if (rv != APR_SUCCESS) {
|
||||
return "Unable to parse URL";
|
||||
}
|
||||
if (!uri.hostname || !uri.scheme) {
|
||||
return "URL must be absolute!";
|
||||
}
|
||||
|
||||
|
||||
ap_str_tolower(uri.hostname);
|
||||
ap_str_tolower(uri.scheme);
|
||||
/*
|
||||
* Workers can be associated w/ balancers or on their
|
||||
* own; ie: the generic reverse-proxy or a worker
|
||||
* in a simple ProxyPass statement. eg:
|
||||
* in a simple ProxyPass statement. eg:
|
||||
*
|
||||
* ProxyPass / http://www.example.com
|
||||
*
|
||||
@@ -1687,7 +1687,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
|
||||
/* we need to allocate space here */
|
||||
*worker = apr_palloc(p, sizeof(proxy_worker));
|
||||
}
|
||||
|
||||
|
||||
memset(*worker, 0, sizeof(proxy_worker));
|
||||
/* right here we just want to tuck away the worker info.
|
||||
* if called during config, we don't have shm setup yet,
|
||||
@@ -1698,8 +1698,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
|
||||
wstatus = apr_palloc(p, sizeof(proxy_worker_shared));
|
||||
#endif
|
||||
memset(wstatus, 0, sizeof(proxy_worker_shared));
|
||||
|
||||
|
||||
|
||||
PROXY_STRNCPY(wstatus->name, apr_uri_unparse(p, &uri, APR_URI_UNP_REVEALPASSWORD));
|
||||
PROXY_STRNCPY(wstatus->scheme, uri.scheme);
|
||||
PROXY_STRNCPY(wstatus->hostname, uri.hostname);
|
||||
@@ -1708,14 +1707,14 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
|
||||
wstatus->flush_wait = PROXY_FLUSH_WAIT;
|
||||
wstatus->smax = -1;
|
||||
wstatus->hash = ap_proxy_hashfunc(wstatus->name, PROXY_HASHFUNC_DEFAULT);
|
||||
|
||||
|
||||
(*worker)->hash = wstatus->hash;
|
||||
(*worker)->context = NULL;
|
||||
(*worker)->cp = NULL;
|
||||
(*worker)->mutex = NULL;
|
||||
(*worker)->balancer = balancer;
|
||||
(*worker)->s = wstatus;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1784,7 +1783,7 @@ 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? */
|
||||
if (worker->local_status & PROXY_WORKER_INITIALIZED) {
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||
"worker %s local already initialized", worker->s->name);
|
||||
"worker %s local already initialized", worker->s->name);
|
||||
}
|
||||
else {
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||
@@ -1796,7 +1795,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||
"can not create connection pool");
|
||||
return APR_EGENERAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (worker->mutex == NULL) {
|
||||
rv = apr_thread_mutex_create(&(worker->mutex), APR_THREAD_MUTEX_DEFAULT, p);
|
||||
@@ -1878,7 +1877,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
||||
proxy_server_conf *conf, char **url)
|
||||
{
|
||||
int access_status;
|
||||
|
||||
|
||||
access_status = proxy_run_pre_request(worker, balancer, r, conf, url);
|
||||
if (access_status == DECLINED && *balancer == NULL) {
|
||||
*worker = ap_proxy_get_worker(r->pool, NULL, conf, *url);
|
||||
@@ -1886,7 +1885,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||
"proxy: %s: found worker %s for %s",
|
||||
(*worker)->s->scheme, (*worker)->s->name, *url);
|
||||
|
||||
|
||||
*balancer = NULL;
|
||||
access_status = OK;
|
||||
}
|
||||
@@ -1946,7 +1945,7 @@ PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker,
|
||||
/* TODO: recycle direct worker */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return access_status;
|
||||
}
|
||||
|
||||
@@ -1961,7 +1960,7 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
||||
apr_status_t rv;
|
||||
int connected = 0;
|
||||
int loglevel;
|
||||
|
||||
|
||||
while (backend_addr && !connected) {
|
||||
if ((rv = apr_socket_create(newsock, backend_addr->family,
|
||||
SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
||||
@@ -1979,7 +1978,7 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
||||
backend_addr = backend_addr->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (conf->recv_buffer_size > 0 &&
|
||||
(rv = apr_socket_opt_set(*newsock, APR_SO_RCVBUF,
|
||||
conf->recv_buffer_size))) {
|
||||
@@ -1987,14 +1986,14 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
||||
"apr_socket_opt_set(SO_RCVBUF): Failed to set "
|
||||
"ProxyReceiveBufferSize, using default");
|
||||
}
|
||||
|
||||
|
||||
rv = apr_socket_opt_set(*newsock, APR_TCP_NODELAY, 1);
|
||||
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"apr_socket_opt_set(APR_TCP_NODELAY): "
|
||||
"Failed to set");
|
||||
}
|
||||
|
||||
|
||||
/* Set a timeout on the socket */
|
||||
if (conf->timeout_set) {
|
||||
apr_socket_timeout_set(*newsock, conf->timeout);
|
||||
@@ -2002,11 +2001,11 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
||||
else {
|
||||
apr_socket_timeout_set(*newsock, r->server->timeout);
|
||||
}
|
||||
|
||||
|
||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||
"proxy: %s: fam %d socket created to connect to %s",
|
||||
proxy_function, backend_addr->family, backend_name);
|
||||
|
||||
|
||||
if (conf->source_address) {
|
||||
rv = apr_socket_bind(*newsock, conf->source_address);
|
||||
if (rv != APR_SUCCESS) {
|
||||
@@ -2015,10 +2014,10 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
||||
proxy_function);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* make the connection out of the socket */
|
||||
rv = apr_socket_connect(*newsock, backend_addr);
|
||||
|
||||
|
||||
/* if an error occurred, loop round and try again */
|
||||
if (rv != APR_SUCCESS) {
|
||||
apr_socket_close(*newsock);
|
||||
@@ -2154,7 +2153,7 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
||||
*
|
||||
* TODO: Handle this much better...
|
||||
*/
|
||||
if (!conn->hostname || !worker->s->is_address_reusable ||
|
||||
if (!conn->hostname || !worker->s->is_address_reusable ||
|
||||
worker->s->disablereuse ||
|
||||
(r->connection->keepalives &&
|
||||
(r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE) &&
|
||||
@@ -2519,7 +2518,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
||||
rv = apr_socket_bind(newsock, local_addr);
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"proxy: %s: failed to bind socket to local address",
|
||||
"proxy: %s: failed to bind socket to local address",
|
||||
proxy_function);
|
||||
}
|
||||
}
|
||||
|
@@ -536,7 +536,7 @@ AP_DECLARE(int) ap_update_child_status_from_conn(ap_sb_handle_t *sbh, int status
|
||||
{
|
||||
if (!sbh)
|
||||
return -1;
|
||||
|
||||
|
||||
return update_child_status_internal(sbh->child_num, sbh->thread_num,
|
||||
status, c, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user