You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2009/12/25 17:28:43 UTC

Re: svn commit: r893871 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c

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

Re: svn commit: r893871 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c

Posted by Nick Kew <ni...@webthing.com>.
On 25 Dec 2009, at 16:28, Ruediger Pluem wrote:

> 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.

Hmm.

I actually tested with a mere ProxyPassReverse / in a <Location /test/>,
and was horrified to find it failed.  So that's what I fixed.  Guess that
could count as hijacking a bug report!

Thanks for the comments - will update it.

-- 
Nick Kew

Re: svn commit: r893871 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Dec 25, 2009, at 11:28 AM, Ruediger Pluem wrote:

> 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.
> 

For ProxyPassReverse? That's right, afaik. Not sure if that's a
bug per se, but certainly would be a nice feature to add...