No pain, I wanted something simple so people can decide if the concept is
worth having. I figured that if I require it, eventually some else
eventually will as well :
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy # diff -u
mod_proxy.h mod_proxy.h.real
--- mod_proxy.h 2011-02-24 07:51:45.000000000 -0500
+++ mod_proxy.h.real 2011-02-03 13:17:10.000000000 -0500
@@ -174,10 +174,6 @@
int error_override_set;
int preserve_host;
int preserve_host_set;
-
- /* Array of URL's for which the hostname needs to be preserved when
proxied */
-
- apr_array_header_t *preserve_host_urls;
apr_interval_time_t timeout;
char timeout_set;
enum {
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy #
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy # diff -u
mod_proxy.c mod_proxy.c.real
--- mod_proxy.c 2011-02-03 14:48:15.000000000 -0500
+++ mod_proxy.c.real 2011-02-03 14:00:05.000000000 -0500
@@ -1068,7 +1068,6 @@
ps->allowed_connect_ports = apr_array_make(p, 10, sizeof(int));
ps->workers = apr_array_make(p, 10, sizeof(proxy_worker));
ps->balancers = apr_array_make(p, 10, sizeof(proxy_balancer));
- ps->preserve_host_urls = apr_array_make(p, 10, sizeof(char*));
ps->forward = NULL;
ps->reverse = NULL;
ps->domain = NULL;
@@ -1111,7 +1110,6 @@
ps->balancers = apr_array_append(p, base->balancers,
overrides->balancers);
ps->forward = overrides->forward ? overrides->forward :
base->forward;
ps->reverse = overrides->reverse ? overrides->reverse :
base->reverse;
- ps->preserve_host_urls = apr_array_append(p,
base->preserve_host_urls, overrides->preserve_host_urls);
ps->domain = (overrides->domain == NULL) ? base->domain :
overrides->domain;
ps->viaopt = (overrides->viaopt_set == 0) ? base->viaopt :
overrides->viaopt;
@@ -1612,21 +1610,6 @@
}
static const char *
-set_preserve_host_url(cmd_parms *parms, void *dummy, const char *arg) -{
- proxy_server_conf *psf =
- ap_get_module_config(parms->server->module_config, &proxy_module); -
- apr_array_header_t *preserve_host_urls =
- psf->preserve_host_urls;
-
- *(const char**)apr_array_push(preserve_host_urls) =
- apr_pstrdup(parms->pool, arg);
-
- return NULL;
-}
-
-static const char *
set_recv_buffer_size(cmd_parms *parms, void *dummy, const char *arg)
{
proxy_server_conf *psf =
@@ -2116,8 +2099,6 @@
"use our error handling pages instead of the servers' we are
proxying"),
AP_INIT_FLAG("ProxyPreserveHost", set_preserve_host, NULL, RSRC_CONF,
"on if we should preserve host header while proxying"),
- AP_INIT_TAKE1("ProxyPreserveHostURL", set_preserve_host_url, NULL,
RSRC_CONF,
- "Set a base URL where the host name needs to be preserved when
proxying"),
AP_INIT_TAKE1("ProxyTimeout", set_proxy_timeout, NULL, RSRC_CONF,
"Set the timeout (in seconds) for a proxied connection. "
"This overrides the server timeout"),
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy #
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy # diff -u
mod_proxy_http.c mod_proxy_http.c.real
--- mod_proxy_http.c 2011-02-03 16:01:19.000000000 -0500
+++ mod_proxy_http.c.real 2011-02-03 13:18:45.000000000 -0500 @@
-674,26 +674,6 @@
return(pass_brigade(bucket_alloc, r, p_conn, origin, header_brigade,
1));
}
-
-
-static
-int ap_not_in_preserve_list(char *url,
- apr_array_header_t *preserve_host_urls,
apr_pool_t *memoryPool)
-{
- int i;
- int l;
-
- for (i = 0; i < preserve_host_urls->nelts; i++) {
- const char *s = ((const char**)preserve_host_urls->elts)[i]; -
l = strlen(s);
-
- if (!strncmp(url, s, l)) {
- return 0;
- }
- }
- return 1;
-}
-
static
int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
proxy_conn_rec *p_conn, conn_rec
*origin,
@@ -750,8 +730,7 @@
ap_xlate_proto_to_ascii(buf, strlen(buf));
e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(header_brigade, e);
- if (conf->preserve_host == 0 &&
- ap_not_in_preserve_list(url, conf->preserve_host_urls, r->pool)) {
+ if (conf->preserve_host == 0) {
if (ap_strchr_c(uri->hostname, ':')) { /* if literal IPv6 address
*/
if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) {
buf = apr_pstrcat(p, "Host: [", uri->hostname, "]:",
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy #
> Jeffrey,
> Sorry to be a pain but can it be in diff -u or svn diff format
> please?
> http://httpd.apache.org/dev/patches.html
> thx!