Bug 33170 - ProxyRemoteMatch uses remote proxy if regex does *not* match
Summary: ProxyRemoteMatch uses remote proxy if regex does *not* match
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.0.52
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2005-01-19 22:57 UTC by Rici Lake
Modified: 2005-02-03 15:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rici Lake 2005-01-19 22:57:56 UTC
The ProxyRemoteMatch directive is supposed to use a regex to redirect certain proxy requests to a 
remote proxy server (as I understand the documentation). I actually needed that for a configuration (see 
below) and was puzzled to find that it doesn't work: (line numbers from APACHE_2_0_BRANCH, because 
I can't find a web interface to svn.)

389 :  p2 = ap_strchr_c(ents[i].scheme, ':');  /* is it a partial URL? */
390 :  if (strcmp(ents[i].scheme, "*") == 0 ||
391 :      (ents[i].use_regex && ap_regexec(ents[i].regexp, url, 0,NULL, 0)) ||
392 :      (p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
393 :      (p2 != NULL &&
394 :       strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) {

ap_regexec returns 0 on success, so the condition in line 391 matches if the regex didn't match, which 
is the reverse of the expected behaviour. Changing line 391 to

391 :      (ents[i].use_regex && ap_regexec(ents[i].regexp, url, 0,NULL, 0) == 0) ||

produced the expected behaviour.

This code seems to have been unchanged since the directive was introduced in 2.0.35, almost three 
years ago, and I cannot find any relevant bug reports; in fact, googling for ProxyRemoteMatch did not 
yield any indication that anyone has ever tried to use the directive, much less succeeded. This would 
seem to be a reasonable case for deleting the directive
Comment 1 Justin Erenkrantz 2005-02-04 00:19:22 UTC
Applied in r151248.  Thanks!