Lines 1048-1054
Link Here
|
1048 |
access_status = proxy_run_scheme_handler(r, worker, |
1048 |
access_status = proxy_run_scheme_handler(r, worker, |
1049 |
conf, url, |
1049 |
conf, url, |
1050 |
ents[i].hostname, |
1050 |
ents[i].hostname, |
1051 |
ents[i].port); |
1051 |
ents[i].port, |
|
|
1052 |
ents[i].auth); |
1052 |
|
1053 |
|
1053 |
/* Did the scheme handler process the request? */ |
1054 |
/* Did the scheme handler process the request? */ |
1054 |
if (access_status != DECLINED) { |
1055 |
if (access_status != DECLINED) { |
Lines 1100-1106
Link Here
|
1100 |
scheme, attempts); |
1101 |
scheme, attempts); |
1101 |
AP_PROXY_RUN(r, worker, conf, url, attempts); |
1102 |
AP_PROXY_RUN(r, worker, conf, url, attempts); |
1102 |
access_status = proxy_run_scheme_handler(r, worker, conf, |
1103 |
access_status = proxy_run_scheme_handler(r, worker, conf, |
1103 |
url, NULL, 0); |
1104 |
url, NULL, 0, NULL); |
1104 |
if (access_status == OK) |
1105 |
if (access_status == OK) |
1105 |
break; |
1106 |
break; |
1106 |
else if (access_status == HTTP_INTERNAL_SERVER_ERROR) { |
1107 |
else if (access_status == HTTP_INTERNAL_SERVER_ERROR) { |
Lines 1339-1345
Link Here
|
1339 |
proxy_server_conf *conf = |
1340 |
proxy_server_conf *conf = |
1340 |
(proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); |
1341 |
(proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); |
1341 |
struct proxy_remote *new; |
1342 |
struct proxy_remote *new; |
1342 |
char *p, *q; |
1343 |
char *p, *q, *a; |
1343 |
char *r, *f, *scheme; |
1344 |
char *r, *f, *scheme; |
1344 |
ap_regex_t *reg = NULL; |
1345 |
ap_regex_t *reg = NULL; |
1345 |
int port; |
1346 |
int port; |
Lines 1347-1352
Link Here
|
1347 |
r = apr_pstrdup(cmd->pool, r1); |
1348 |
r = apr_pstrdup(cmd->pool, r1); |
1348 |
scheme = apr_pstrdup(cmd->pool, r1); |
1349 |
scheme = apr_pstrdup(cmd->pool, r1); |
1349 |
f = apr_pstrdup(cmd->pool, f1); |
1350 |
f = apr_pstrdup(cmd->pool, f1); |
|
|
1351 |
/* separate different items from remote proxy server configuration |
1352 |
* r = <scheme>://[<auth>@]<host>[:<port>] |
1353 |
*/ |
1354 |
/* separate scheme (must) */ |
1350 |
p = strchr(r, ':'); |
1355 |
p = strchr(r, ':'); |
1351 |
if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') { |
1356 |
if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') { |
1352 |
if (regex) |
1357 |
if (regex) |
Lines 1355-1363
Link Here
|
1355 |
return "ProxyRemote: Bad syntax for a remote proxy server"; |
1360 |
return "ProxyRemote: Bad syntax for a remote proxy server"; |
1356 |
} |
1361 |
} |
1357 |
else { |
1362 |
else { |
1358 |
scheme[p-r] = 0; |
1363 |
scheme[p-r] = '\0'; |
|
|
1364 |
} |
1365 |
*p = '\0'; /* terminate r (scheme) */ |
1366 |
p+=3; |
1367 |
/* separate authentication string (optional, default = NULL) */ |
1368 |
q = strchr(p, '@'); |
1369 |
if (q != NULL) { |
1370 |
*q = '\0'; |
1371 |
/* missing: syntax check of the auth string |
1372 |
* but do we really need this? |
1373 |
*/ |
1374 |
a = ap_pbase64encode(cmd->pool, p); |
1375 |
p = q; |
1376 |
p+=1; |
1377 |
} |
1378 |
else { |
1379 |
a = NULL; |
1359 |
} |
1380 |
} |
1360 |
q = strchr(p + 3, ':'); |
1381 |
/* separate port (optional, default = default port of scheme) */ |
|
|
1382 |
q = strchr(p, ':'); |
1361 |
if (q != NULL) { |
1383 |
if (q != NULL) { |
1362 |
if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) { |
1384 |
if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) { |
1363 |
if (regex) |
1385 |
if (regex) |
Lines 1367-1384
Link Here
|
1367 |
} |
1389 |
} |
1368 |
*q = '\0'; |
1390 |
*q = '\0'; |
1369 |
} |
1391 |
} |
1370 |
else |
1392 |
else { |
1371 |
port = -1; |
1393 |
port = -1; |
1372 |
*p = '\0'; |
1394 |
} |
|
|
1395 |
|
1373 |
if (regex) { |
1396 |
if (regex) { |
1374 |
reg = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED); |
1397 |
reg = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED); |
1375 |
if (!reg) |
1398 |
if (!reg) |
1376 |
return "Regular expression for ProxyRemoteMatch could not be compiled."; |
1399 |
return "Regular expression for ProxyRemoteMatch could not be compiled."; |
1377 |
} |
1400 |
} |
1378 |
else |
1401 |
else if (strchr(f, ':') == NULL) { |
1379 |
if (strchr(f, ':') == NULL) |
1402 |
ap_str_tolower(f); /* lowercase scheme */ |
1380 |
ap_str_tolower(f); /* lowercase scheme */ |
1403 |
} |
1381 |
ap_str_tolower(p + 3); /* lowercase hostname */ |
1404 |
ap_str_tolower(p); /* lowercase hostname */ |
1382 |
|
1405 |
|
1383 |
if (port == -1) { |
1406 |
if (port == -1) { |
1384 |
port = apr_uri_port_of_scheme(scheme); |
1407 |
port = apr_uri_port_of_scheme(scheme); |
Lines 1387-1394
Link Here
|
1387 |
new = apr_array_push(conf->proxies); |
1410 |
new = apr_array_push(conf->proxies); |
1388 |
new->scheme = f; |
1411 |
new->scheme = f; |
1389 |
new->protocol = r; |
1412 |
new->protocol = r; |
1390 |
new->hostname = p + 3; |
1413 |
new->hostname = p; |
1391 |
new->port = port; |
1414 |
new->port = port; |
|
|
1415 |
new->auth = a; |
1392 |
new->regexp = reg; |
1416 |
new->regexp = reg; |
1393 |
new->use_regex = regex; |
1417 |
new->use_regex = regex; |
1394 |
return NULL; |
1418 |
return NULL; |
Lines 2292-2298
Link Here
|
2292 |
AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, |
2316 |
AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, |
2293 |
"on if the true proxy requests should be accepted"), |
2317 |
"on if the true proxy requests should be accepted"), |
2294 |
AP_INIT_TAKE2("ProxyRemote", add_proxy_noregex, NULL, RSRC_CONF, |
2318 |
AP_INIT_TAKE2("ProxyRemote", add_proxy_noregex, NULL, RSRC_CONF, |
2295 |
"a scheme, partial URL or '*' and a proxy server"), |
2319 |
"a scheme, partial URL or '*' and a proxy server optional with auth"), |
2296 |
AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF, |
2320 |
AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF, |
2297 |
"a regex pattern and a proxy server"), |
2321 |
"a regex pattern and a proxy server"), |
2298 |
AP_INIT_FLAG("ProxyPassInterpolateEnv", ap_set_flag_slot_char, |
2322 |
AP_INIT_FLAG("ProxyPassInterpolateEnv", ap_set_flag_slot_char, |
Lines 2655-2662
Link Here
|
2655 |
(request_rec *r, proxy_worker *worker, |
2679 |
(request_rec *r, proxy_worker *worker, |
2656 |
proxy_server_conf *conf, |
2680 |
proxy_server_conf *conf, |
2657 |
char *url, const char *proxyhost, |
2681 |
char *url, const char *proxyhost, |
2658 |
apr_port_t proxyport),(r,worker,conf, |
2682 |
apr_port_t proxyport, |
2659 |
url,proxyhost,proxyport),DECLINED) |
2683 |
const char *proxyauth), |
|
|
2684 |
(r,worker,conf, |
2685 |
url,proxyhost,proxyport, proxyauth),DECLINED) |
2660 |
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, canon_handler, |
2686 |
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, canon_handler, |
2661 |
(request_rec *r, char *url),(r, |
2687 |
(request_rec *r, char *url),(r, |
2662 |
url),DECLINED) |
2688 |
url),DECLINED) |