View | Details | Raw Unified | Return to bug 43308
Collapse All | Expand All

(-)mod_proxy.c.orig (-10 / +22 lines)
Lines 54-69 Link Here
54
/* -------------------------------------------------------------- */
54
/* -------------------------------------------------------------- */
55
/* Translate the URL into a 'filename' */
55
/* Translate the URL into a 'filename' */
56
56
57
#define PROXY_COPY_CONF_PARAMS(w, c) \
58
    do {                             \
59
        (w)->timeout              = (c)->timeout;               \
60
        (w)->timeout_set          = (c)->timeout_set;           \
61
        (w)->recv_buffer_size     = (c)->recv_buffer_size;      \
62
        (w)->recv_buffer_size_set = (c)->recv_buffer_size_set;  \
63
        (w)->io_buffer_size       = (c)->io_buffer_size;        \
64
        (w)->io_buffer_size_set   = (c)->io_buffer_size_set;    \
65
    } while (0)
66
67
static const char *set_worker_param(apr_pool_t *p,
57
static const char *set_worker_param(apr_pool_t *p,
68
                                    proxy_worker *worker,
58
                                    proxy_worker *worker,
69
                                    const char *key,
59
                                    const char *key,
Lines 871-876 Link Here
871
    ps->badopt = bad_error;
861
    ps->badopt = bad_error;
872
    ps->badopt_set = 0;
862
    ps->badopt_set = 0;
873
    ps->pool = p;
863
    ps->pool = p;
864
    ps->maxaddtlworkers = 0;
874
865
875
    return ps;
866
    return ps;
876
}
867
}
Lines 904-909 Link Here
904
    ps->badopt = (overrides->badopt_set == 0) ? base->badopt : overrides->badopt;
895
    ps->badopt = (overrides->badopt_set == 0) ? base->badopt : overrides->badopt;
905
    ps->proxy_status = (overrides->proxy_status_set == 0) ? base->proxy_status : overrides->proxy_status;
896
    ps->proxy_status = (overrides->proxy_status_set == 0) ? base->proxy_status : overrides->proxy_status;
906
    ps->pool = p;
897
    ps->pool = p;
898
    ps->maxaddtlworkers = (overrides->maxaddtlworkers == 0) ? base->maxaddtlworkers : overrides->maxaddtlworkers;
899
907
    return ps;
900
    return ps;
908
}
901
}
909
902
Lines 1574-1579 Link Here
1574
    return NULL;
1567
    return NULL;
1575
}
1568
}
1576
1569
1570
static const char*
1571
    set_proxy_maxaddtlworkers(cmd_parms *parms, void *dummy, const char *arg)
1572
{
1573
    proxy_server_conf *psf =
1574
    ap_get_module_config(parms->server->module_config, &proxy_module);
1575
    int maxworkers;
1576
1577
    maxworkers=atoi(arg);
1578
    if (maxworkers<1) {
1579
        return "Number of additional workers must be at least 0.";
1580
    }
1581
    psf->maxaddtlworkers=maxworkers;
1582
    proxy_lb_workers += maxworkers;
1583
1584
    return NULL;
1585
}
1586
1577
static void ap_add_per_proxy_conf(server_rec *s, ap_conf_vector_t *dir_config)
1587
static void ap_add_per_proxy_conf(server_rec *s, ap_conf_vector_t *dir_config)
1578
{
1588
{
1579
    proxy_server_conf *sconf = ap_get_module_config(s->module_config,
1589
    proxy_server_conf *sconf = ap_get_module_config(s->module_config,
Lines 1720-1725 Link Here
1720
     "Configure Status: proxy status to one of: on | off | full"),
1730
     "Configure Status: proxy status to one of: on | off | full"),
1721
    AP_INIT_RAW_ARGS("ProxySet", set_proxy_param, NULL, RSRC_CONF|ACCESS_CONF,
1731
    AP_INIT_RAW_ARGS("ProxySet", set_proxy_param, NULL, RSRC_CONF|ACCESS_CONF,
1722
     "A balancer or worker name with list of params"),
1732
     "A balancer or worker name with list of params"),
1733
    AP_INIT_TAKE1("ProxyMaxAddtlWorkers", set_proxy_maxaddtlworkers, NULL, RSRC_CONF,
1734
     "The maximum number of proxy workers that may be created implicitly."),
1723
    {NULL}
1735
    {NULL}
1724
};
1736
};
1725
1737
(-)mod_proxy.h.orig (+11 lines)
Lines 186-191 Link Here
186
    } proxy_status;             /* Status display options */
186
    } proxy_status;             /* Status display options */
187
    char proxy_status_set;
187
    char proxy_status_set;
188
    apr_pool_t *pool;           /* Pool used for allocating this struct */
188
    apr_pool_t *pool;           /* Pool used for allocating this struct */
189
    int maxaddtlworkers;
189
} proxy_server_conf;
190
} proxy_server_conf;
190
191
191
192
Lines 266-271 Link Here
266
#define PROXY_WORKER_DEFAULT_RETRY  60
267
#define PROXY_WORKER_DEFAULT_RETRY  60
267
#define PROXY_WORKER_MAX_ROUTE_SIZ  63
268
#define PROXY_WORKER_MAX_ROUTE_SIZ  63
268
269
270
#define PROXY_COPY_CONF_PARAMS(w, c) \
271
    do {                             \
272
        (w)->timeout              = (c)->timeout;               \
273
        (w)->timeout_set          = (c)->timeout_set;           \
274
        (w)->recv_buffer_size     = (c)->recv_buffer_size;      \
275
        (w)->recv_buffer_size_set = (c)->recv_buffer_size_set;  \
276
        (w)->io_buffer_size       = (c)->io_buffer_size;        \
277
        (w)->io_buffer_size_set   = (c)->io_buffer_size_set;    \
278
    } while (0)
279
269
/* Runtime worker status informations. Shared in scoreboard */
280
/* Runtime worker status informations. Shared in scoreboard */
270
typedef struct {
281
typedef struct {
271
    int             status;
282
    int             status;
(-)proxy_util.c.orig (-6 / +50 lines)
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 */

Return to bug 43308