Lines 32-37
Link Here
|
32 |
/* Global balancer counter */ |
32 |
/* Global balancer counter */ |
33 |
int PROXY_DECLARE_DATA proxy_lb_workers = 0; |
33 |
int PROXY_DECLARE_DATA proxy_lb_workers = 0; |
34 |
static int lb_workers_limit = 0; |
34 |
static int lb_workers_limit = 0; |
|
|
35 |
static int addtl_workers = 0; |
35 |
|
36 |
|
36 |
static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r); |
37 |
static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r); |
37 |
static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); |
38 |
static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); |
Lines 1394-1407
Link Here
|
1394 |
} |
1395 |
} |
1395 |
else if (r->proxyreq == PROXYREQ_REVERSE) { |
1396 |
else if (r->proxyreq == PROXYREQ_REVERSE) { |
1396 |
if (conf->reverse) { |
1397 |
if (conf->reverse) { |
1397 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, |
|
|
1398 |
"proxy: *: found reverse proxy worker for %s", |
1399 |
*url); |
1400 |
*balancer = NULL; |
1398 |
*balancer = NULL; |
1401 |
*worker = conf->reverse; |
1399 |
|
1402 |
access_status = OK; |
1400 |
char *c; |
|
|
1401 |
char url_copy[strlen(*url) + 1]; |
1402 |
|
1403 |
/* Make a copy of the URL where the path is truncated */ |
1404 |
strcpy(url_copy, *url); |
1405 |
c = ap_strchr_c(url_copy, ':'); |
1406 |
|
1407 |
if ( !(c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') ) { |
1408 |
c = ap_strchr_c(c+3, '/'); |
1409 |
if ( c[0] == '/' ) |
1410 |
c[1] = '\0'; |
1411 |
} |
1412 |
|
1413 |
if ( addtl_workers < conf->maxaddtlworkers ) { |
1414 |
const char *err = ap_proxy_add_worker(worker, conf->pool, conf, url_copy); |
1415 |
if (err) { |
1416 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, |
1417 |
"proxy: unable to add new reverse proxy worker for %s - %s", |
1418 |
*url, err); |
1419 |
} |
1420 |
else |
1421 |
{ |
1422 |
addtl_workers += 1; |
1423 |
PROXY_COPY_CONF_PARAMS((proxy_worker *) *worker, |
1424 |
(proxy_server_conf *) conf); |
1425 |
|
1426 |
ap_proxy_initialize_worker_share(conf, *worker, r->server); |
1427 |
ap_proxy_initialize_worker(*worker, r->server); |
1428 |
/* Do not disable worker in case of errors */ |
1429 |
(*worker)->s->status |= PROXY_WORKER_IGNORE_ERRORS; |
1430 |
(*worker)->is_address_reusable = 1; |
1431 |
*worker = ap_proxy_get_worker(r->pool, conf, *url); |
1432 |
} |
1433 |
} |
1434 |
else { |
1435 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, |
1436 |
"proxy: cannot create additional worker %s - ProxyMaxAddtlWorkers limit reached (%d)", |
1437 |
url_copy, conf->maxaddtlworkers); |
1438 |
} |
1439 |
|
1440 |
if (!*worker) { |
1441 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, |
1442 |
"proxy: *: found reverse proxy worker for %s", |
1443 |
*url); |
1444 |
*worker = conf->reverse; |
1445 |
} |
1446 |
access_status = OK; |
1403 |
} |
1447 |
} |
1404 |
} |
1448 |
} |
1405 |
} |
1449 |
} |
1406 |
else if (access_status == DECLINED && *balancer != NULL) { |
1450 |
else if (access_status == DECLINED && *balancer != NULL) { |
1407 |
/* All the workers are busy */ |
1451 |
/* All the workers are busy */ |