You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2009/12/25 16:26:50 UTC
svn commit: r893871 - in /httpd/httpd/trunk: CHANGES
modules/proxy/proxy_util.c
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
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=893871&r1=893870&r2=893871&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Dec 25 15:26:49 2009
@@ -30,6 +30,9 @@
ScanHTMLTitles, ReadmeName, HeaderName
PR 48416 [Dmitry Bakshaev <dab18 izhnet.ru>, Nick Kew]
+ *) Proxy: Fix ProxyPassReverse with relative URL.
+ PR 38864 [Nick Kew]
+
Changes with Apache 2.3.4
*) Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex,
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, "/");
+ if (part) {
+ url = part;
+ l1 = strlen(url);
+ }
+ }
+ }
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);
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...
Re: svn commit: r893871 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c
Posted by Ruediger Pluem <rp...@apache.org>.
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