httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeffrey E Burgoyne" <burgo...@keenuh.com>
Subject Re: ProxyPreserveHost - added functionality
Date Thu, 24 Feb 2011 12:55:26 GMT
Against 2.2.14 source, in short, add an array of URL's for which the
preserveproxyhost is required, bit of code for the config parameter, and a
small change to check if the URL matches one of the list.




ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy # diff
mod_proxy.h mod_proxy.h.real
177,180d176
<
<     /* Array of URL's for which the hostname needs to be preserved when
proxied  */
<
<     apr_array_header_t *preserve_host_urls;
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy #


ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy # diff
mod_proxy.c mod_proxy.c.real
1071d1070
<     ps->preserve_host_urls = apr_array_make(p, 10, sizeof(char*));
1114d1112
<     ps->preserve_host_urls = apr_array_append(p,
base->preserve_host_urls, overrides->preserve_host_urls);
1615,1629d1612
< 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 *
2119,2120d2101
<     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"),
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy #


ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy # diff
mod_proxy_http.c mod_proxy_http.c.real
677,696d676
<
<
< 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;
< }
<
753,754c733
<     if (conf->preserve_host == 0 &&
<         ap_not_in_preserve_list(url, conf->preserve_host_urls, r->pool)) {
---
>     if (conf->preserve_host == 0) {
ht01b07:~/apacheConfig/tarball/httpd-2.2.14/modules/proxy #







> Quite small, only took a few hours to do. I'll post it tomorrow.
>
> Basically it does the same as PreserveProxyHost except it works on a URL
> basis, not on a per virtual host basis.
>
>
>> On Wed, 23 Feb 2011 14:12:44 -0500
>> "Jeffrey E Burgoyne" <burgoyne@keenuh.com> wrote:
>>
>>
>>> If people feel this is a worthwhile addition to the main code base,
>>> please
>>> let me know and I'll pass it back.
>>
>> Not sure I follow exactly what you've added.
>>
>> How big a patch is your change?  If it's not too big to admit
>> easy review, you could post it or a URL to look at it.
>>
>>
>> --
>> Nick Kew
>>
>> Available for work, contract or permanent.
>> http://www.webthing.com/~nick/cv.html
>>
>
>
> --
> Jeffrey Burgoyne
> Chief Technology Officer
> KCSI Keenuh Consulting Services Inc
> www.keenuh.com
> burgoyne@keenuh.com
>
>
>


-- 
Jeffrey Burgoyne
Chief Technology Officer
KCSI Keenuh Consulting Services Inc
www.keenuh.com
burgoyne@keenuh.com



Mime
View raw message