Lines 1324-1329
Link Here
|
1324 |
proxy_worker *max_worker = NULL; |
1324 |
proxy_worker *max_worker = NULL; |
1325 |
int max_match = 0; |
1325 |
int max_match = 0; |
1326 |
int url_length; |
1326 |
int url_length; |
|
|
1327 |
int min_match; |
1327 |
int worker_name_length; |
1328 |
int worker_name_length; |
1328 |
const char *c; |
1329 |
const char *c; |
1329 |
char *url_copy; |
1330 |
char *url_copy; |
Lines 1349-1368
Link Here
|
1349 |
pathstart = url_copy + (c - url); |
1350 |
pathstart = url_copy + (c - url); |
1350 |
*pathstart = '\0'; |
1351 |
*pathstart = '\0'; |
1351 |
ap_str_tolower(url_copy); |
1352 |
ap_str_tolower(url_copy); |
|
|
1353 |
min_match = strlen(url_copy); |
1352 |
*pathstart = '/'; |
1354 |
*pathstart = '/'; |
1353 |
} |
1355 |
} |
1354 |
else { |
1356 |
else { |
1355 |
ap_str_tolower(url_copy); |
1357 |
ap_str_tolower(url_copy); |
|
|
1358 |
min_match = strlen(url_copy); |
1356 |
} |
1359 |
} |
1357 |
|
1360 |
|
1358 |
worker = (proxy_worker *)conf->workers->elts; |
1361 |
worker = (proxy_worker *)conf->workers->elts; |
1359 |
|
1362 |
|
1360 |
/* |
1363 |
/* |
1361 |
* Do a "longest match" on the worker name to find the worker that |
1364 |
* Do a "longest match" on the worker name to find the worker that |
1362 |
* fits best to the URL. |
1365 |
* fits best to the URL, but keep in mind that we must have at least |
|
|
1366 |
* a minimum matching of length min_match such that |
1367 |
* scheme://hostname[:port] matches between worker and url. |
1363 |
*/ |
1368 |
*/ |
1364 |
for (i = 0; i < conf->workers->nelts; i++) { |
1369 |
for (i = 0; i < conf->workers->nelts; i++) { |
1365 |
if ( ((worker_name_length = strlen(worker->name)) <= url_length) |
1370 |
if ( ((worker_name_length = strlen(worker->name)) <= url_length) |
|
|
1371 |
&& (worker_name_length >= min_match) |
1366 |
&& (worker_name_length > max_match) |
1372 |
&& (worker_name_length > max_match) |
1367 |
&& (strncmp(url_copy, worker->name, worker_name_length) == 0) ) { |
1373 |
&& (strncmp(url_copy, worker->name, worker_name_length) == 0) ) { |
1368 |
max_worker = worker; |
1374 |
max_worker = worker; |