Line
Link Here
|
0 |
-- httpd-2.4.37/modules/proxy/mod_proxy.c.pr37355 |
0 |
++ httpd-2.4.37/modules/proxy/mod_proxy.c |
Lines 1200-1210
Link Here
|
1200 |
/* handle the scheme */ |
1200 |
/* handle the scheme */ |
1201 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01142) |
1201 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01142) |
1202 |
"Trying to run scheme_handler against proxy"); |
1202 |
"Trying to run scheme_handler against proxy"); |
|
|
1203 |
|
1204 |
if (ents[i].creds) { |
1205 |
apr_table_set(r->notes, "proxy-basic-creds", ents[i].creds); |
1206 |
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, |
1207 |
"Using proxy auth creds %s", ents[i].creds); |
1208 |
} |
1209 |
|
1203 |
access_status = proxy_run_scheme_handler(r, worker, |
1210 |
access_status = proxy_run_scheme_handler(r, worker, |
1204 |
conf, url, |
1211 |
conf, url, |
1205 |
ents[i].hostname, |
1212 |
ents[i].hostname, |
1206 |
ents[i].port); |
1213 |
ents[i].port); |
1207 |
|
1214 |
|
|
|
1215 |
if (ents[i].creds) apr_table_unset(r->notes, "proxy-basic-creds"); |
1216 |
|
1208 |
/* Did the scheme handler process the request? */ |
1217 |
/* Did the scheme handler process the request? */ |
1209 |
if (access_status != DECLINED) { |
1218 |
if (access_status != DECLINED) { |
1210 |
const char *cl_a; |
1219 |
const char *cl_a; |
Lines 1621-1628
Link Here
|
1621 |
return new; |
1630 |
return new; |
1622 |
} |
1631 |
} |
1623 |
|
1632 |
|
1624 |
static const char * |
1633 |
static const char *add_proxy(cmd_parms *cmd, void *dummy, const char *f1, |
1625 |
add_proxy(cmd_parms *cmd, void *dummy, const char *f1, const char *r1, int regex) |
1634 |
const char *r1, const char *creds, int regex) |
1626 |
{ |
1635 |
{ |
1627 |
server_rec *s = cmd->server; |
1636 |
server_rec *s = cmd->server; |
1628 |
proxy_server_conf *conf = |
1637 |
proxy_server_conf *conf = |
Lines 1680-1698
Link Here
|
1680 |
new->port = port; |
1689 |
new->port = port; |
1681 |
new->regexp = reg; |
1690 |
new->regexp = reg; |
1682 |
new->use_regex = regex; |
1691 |
new->use_regex = regex; |
|
|
1692 |
if (creds) { |
1693 |
new->creds = apr_pstrcat(cmd->pool, "Basic ", |
1694 |
ap_pbase64encode(cmd->pool, (char *)creds), |
1695 |
NULL); |
1696 |
} |
1683 |
return NULL; |
1697 |
return NULL; |
1684 |
} |
1698 |
} |
1685 |
|
1699 |
|
1686 |
static const char * |
1700 |
static const char *add_proxy_noregex(cmd_parms *cmd, void *dummy, const char *f1, |
1687 |
add_proxy_noregex(cmd_parms *cmd, void *dummy, const char *f1, const char *r1) |
1701 |
const char *r1, const char *creds) |
1688 |
{ |
1702 |
{ |
1689 |
return add_proxy(cmd, dummy, f1, r1, 0); |
1703 |
return add_proxy(cmd, dummy, f1, r1, creds, 0); |
1690 |
} |
1704 |
} |
1691 |
|
1705 |
|
1692 |
static const char * |
1706 |
static const char *add_proxy_regex(cmd_parms *cmd, void *dummy, const char *f1, |
1693 |
add_proxy_regex(cmd_parms *cmd, void *dummy, const char *f1, const char *r1) |
1707 |
const char *r1, const char *creds) |
1694 |
{ |
1708 |
{ |
1695 |
return add_proxy(cmd, dummy, f1, r1, 1); |
1709 |
return add_proxy(cmd, dummy, f1, r1, creds, 1); |
1696 |
} |
1710 |
} |
1697 |
|
1711 |
|
1698 |
PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url) |
1712 |
PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url) |
Lines 2638-2646
Link Here
|
2638 |
"location, in regular expression syntax"), |
2652 |
"location, in regular expression syntax"), |
2639 |
AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, |
2653 |
AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, |
2640 |
"on if the true proxy requests should be accepted"), |
2654 |
"on if the true proxy requests should be accepted"), |
2641 |
AP_INIT_TAKE2("ProxyRemote", add_proxy_noregex, NULL, RSRC_CONF, |
2655 |
AP_INIT_TAKE23("ProxyRemote", add_proxy_noregex, NULL, RSRC_CONF, |
2642 |
"a scheme, partial URL or '*' and a proxy server"), |
2656 |
"a scheme, partial URL or '*' and a proxy server"), |
2643 |
AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF, |
2657 |
AP_INIT_TAKE23("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF, |
2644 |
"a regex pattern and a proxy server"), |
2658 |
"a regex pattern and a proxy server"), |
2645 |
AP_INIT_FLAG("ProxyPassInterpolateEnv", ap_set_flag_slot_char, |
2659 |
AP_INIT_FLAG("ProxyPassInterpolateEnv", ap_set_flag_slot_char, |
2646 |
(void*)APR_OFFSETOF(proxy_dir_conf, interpolate_env), |
2660 |
(void*)APR_OFFSETOF(proxy_dir_conf, interpolate_env), |
2647 |
-- httpd-2.4.37/modules/proxy/mod_proxy.h.pr37355 |
2661 |
++ httpd-2.4.37/modules/proxy/mod_proxy.h |
Lines 116-121
Link Here
|
116 |
const char *protocol; /* the scheme used to talk to this proxy */ |
116 |
const char *protocol; /* the scheme used to talk to this proxy */ |
117 |
const char *hostname; /* the hostname of this proxy */ |
117 |
const char *hostname; /* the hostname of this proxy */ |
118 |
ap_regex_t *regexp; /* compiled regex (if any) for the remote */ |
118 |
ap_regex_t *regexp; /* compiled regex (if any) for the remote */ |
|
|
119 |
const char *creds; /* auth credentials (if any) for the proxy */ |
119 |
int use_regex; /* simple boolean. True if we have a regex pattern */ |
120 |
int use_regex; /* simple boolean. True if we have a regex pattern */ |
120 |
apr_port_t port; /* the port for this proxy */ |
121 |
apr_port_t port; /* the port for this proxy */ |
121 |
}; |
122 |
}; |
122 |
-- httpd-2.4.37/modules/proxy/proxy_util.c.pr37355 |
123 |
++ httpd-2.4.37/modules/proxy/proxy_util.c |
Lines 2446-2452
Link Here
|
2446 |
* So let's make it configurable by env. |
2446 |
* So let's make it configurable by env. |
2447 |
* The logic here is the same used in mod_proxy_http. |
2447 |
* The logic here is the same used in mod_proxy_http. |
2448 |
*/ |
2448 |
*/ |
2449 |
proxy_auth = apr_table_get(r->headers_in, "Proxy-Authorization"); |
2449 |
proxy_auth = apr_table_get(r->notes, "proxy-basic-creds"); |
|
|
2450 |
if (proxy_auth == NULL) |
2451 |
proxy_auth = apr_table_get(r->headers_in, "Proxy-Authorization"); |
2452 |
|
2450 |
if (proxy_auth != NULL && |
2453 |
if (proxy_auth != NULL && |
2451 |
proxy_auth[0] != '\0' && |
2454 |
proxy_auth[0] != '\0' && |
2452 |
r->user == NULL && /* we haven't yet authenticated */ |
2455 |
r->user == NULL && /* we haven't yet authenticated */ |
Lines 2672-2678
Link Here
|
2672 |
nbytes = apr_snprintf(buffer, sizeof(buffer), |
2675 |
nbytes = apr_snprintf(buffer, sizeof(buffer), |
2673 |
"CONNECT %s:%d HTTP/1.0" CRLF, |
2676 |
"CONNECT %s:%d HTTP/1.0" CRLF, |
2674 |
forward->target_host, forward->target_port); |
2677 |
forward->target_host, forward->target_port); |
2675 |
/* Add proxy authorization from the initial request if necessary */ |
2678 |
/* Add proxy authorization from the configuration, or initial |
|
|
2679 |
* request if necessary */ |
2676 |
if (forward->proxy_auth != NULL) { |
2680 |
if (forward->proxy_auth != NULL) { |
2677 |
nbytes += apr_snprintf(buffer + nbytes, sizeof(buffer) - nbytes, |
2681 |
nbytes += apr_snprintf(buffer + nbytes, sizeof(buffer) - nbytes, |
2678 |
"Proxy-Authorization: %s" CRLF, |
2682 |
"Proxy-Authorization: %s" CRLF, |
Lines 3567-3572
Link Here
|
3567 |
apr_bucket *e; |
3571 |
apr_bucket *e; |
3568 |
int do_100_continue; |
3572 |
int do_100_continue; |
3569 |
conn_rec *origin = p_conn->connection; |
3573 |
conn_rec *origin = p_conn->connection; |
|
|
3574 |
const char *creds; |
3570 |
proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, &proxy_module); |
3575 |
proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, &proxy_module); |
3571 |
|
3576 |
|
3572 |
/* |
3577 |
/* |
Lines 3743-3748
Link Here
|
3743 |
return HTTP_BAD_REQUEST; |
3748 |
return HTTP_BAD_REQUEST; |
3744 |
} |
3749 |
} |
3745 |
|
3750 |
|
|
|
3751 |
creds = apr_table_get(r->notes, "proxy-basic-creds"); |
3752 |
if (creds) { |
3753 |
apr_table_mergen(r->headers_in, "Proxy-Authorization", creds); |
3754 |
} |
3755 |
|
3746 |
/* send request headers */ |
3756 |
/* send request headers */ |
3747 |
headers_in_array = apr_table_elts(r->headers_in); |
3757 |
headers_in_array = apr_table_elts(r->headers_in); |
3748 |
headers_in = (const apr_table_entry_t *) headers_in_array->elts; |
3758 |
headers_in = (const apr_table_entry_t *) headers_in_array->elts; |