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: r893871 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c
Date Fri, 25 Dec 2009 16:28:43 GMT
On 25.12.2009 16:26, niq@apache.org wrote:
> Author: niq
> Date: Fri Dec 25 15:26:49 2009
> New Revision: 893871
> 
> URL: http://svn.apache.org/viewvc?rev=893871&view=rev
> Log:
> Proxy: fix ProxyPassReverse with relative URL
> PR 38864
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/modules/proxy/proxy_util.c
> 

Currently I don't get how this relates to
https://issues.apache.org/bugzilla/show_bug.cgi?id=38864#c7
The reporter had an issue with LocationMatch. IMHO regular expression
still do not work as fake parts.


> Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=893871&r1=893870&r2=893871&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
> +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Dec 25 15:26:49 2009
> @@ -1117,6 +1117,16 @@
>          }
>          else {
>              l2 = strlen(real);
> +            if (real[0] == '/') {
> +                const char *part = strstr(url, "://");
> +                if (part) {
> +                    part = strstr(part+3, "/");

I guess using strchr should be faster in this case.

> +                    if (part) {
> +                        url = part;
> +                        l1 = strlen(url);
> +                    }
> +                }
> +            }

Hm, if we do not have a match below and leave the loop afterwards you have
changed the value of url and url is returned at the end of the function.
I guess you should use a temporary variable here to avoid this.

>              if (l1 >= l2 && strncasecmp(real, url, l2) == 0) {
>                  u = apr_pstrcat(r->pool, ent[i].fake, &url[l2], NULL);
>                  return ap_construct_url(r->pool, u, r);
> 
> 
> 

Regards

RĂ¼diger

Mime
View raw message