httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r537429 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h
Date Sat, 12 May 2007 15:10:28 GMT


On 05/12/2007 04:12 PM, jim@apache.org wrote:
> Author: jim
> Date: Sat May 12 07:12:24 2007
> New Revision: 537429
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=537429
> Log:
> Add regex pattern matching to ProxyPass, allowing,
> for example:
> 
>    ProxyPass ~ \.gif balancer://imagecluster
> 
> 
> 
> Modified:
>     httpd/httpd/trunk/modules/proxy/mod_proxy.c
>     httpd/httpd/trunk/modules/proxy/mod_proxy.h
> 
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?view=diff&rev=537429&r1=537428&r2=537429
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Sat May 12 07:12:24 2007
> @@ -510,19 +512,34 @@
>              fake = ent[i].fake;
>              real = ent[i].real;
>          }
> -        len = alias_match(r->uri, fake);
> +        if (ent[i].regex) {
> +            if (!ap_regexec(ent[i].regex, r->uri, AP_MAX_REG_MATCH, regm, 0)) {
> +                if ((real[0] == '!') && (real[1] == '\0')) {
> +                    return DECLINED;
> +                }
> +                found = apr_pstrcat(r->pool, "proxy:", real,
> +                                    r->uri, NULL);
> +            }
> +        }
> +        else {
> +            len = alias_match(r->uri, fake);
>  
> -       if (len > 0) {
> -           if ((real[0] == '!') && (real[1] == 0)) {
> -               return DECLINED;
> -           }
> +            if (len != 0) {
> +                if ((real[0] == '!') && (real[1] == '\0')) {
> +                    return DECLINED;
> +                }
>  
> -           r->filename = apr_pstrcat(r->pool, "proxy:", real,
> +                found = apr_pstrcat(r->pool, "proxy:", real,
>                                       r->uri + len, NULL);

Sorry for being picky here: One space too much.

> -           r->handler = "proxy-server";
> -           r->proxyreq = PROXYREQ_REVERSE;
> -           return OK;
> -       }
> +
> +            }
> +        }
> +        if (found) {
> +                r->filename = found;
> +                r->handler = "proxy-server";
> +                r->proxyreq = PROXYREQ_REVERSE;
> +                return OK;
> +        }

Again I am picky here: Too many spaces.

> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?view=diff&rev=537429&r1=537428&r2=537429
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Sat May 12 07:12:24 2007
> @@ -109,6 +109,7 @@
>  struct proxy_alias {
>      const char  *real;
>      const char  *fake;
> +    ap_regex_t  *regex;
>  };

Doesn't this require a minor bump?

Regards

RĂ¼diger


Mime
View raw message