Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 43901 invoked from network); 31 Oct 2005 16:31:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Oct 2005 16:31:56 -0000 Received: (qmail 65657 invoked by uid 500); 31 Oct 2005 16:31:55 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 65614 invoked by uid 500); 31 Oct 2005 16:31:54 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 65603 invoked by uid 99); 31 Oct 2005 16:31:54 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 31 Oct 2005 08:31:54 -0800 Received: (qmail 43779 invoked by uid 65534); 31 Oct 2005 16:31:34 -0000 Message-ID: <20051031163134.43778.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r329849 - in /httpd/httpd/trunk: CHANGES modules/proxy/proxy_util.c Date: Mon, 31 Oct 2005 16:31:33 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jim Date: Mon Oct 31 08:31:29 2005 New Revision: 329849 URL: http://svn.apache.org/viewcvs?rev=329849&view=rev Log: Fix a problem where we are doing a case insensitive match between the worker and the URL. Instead, only the scheme and hostname are insensitive, the rest should be case sensitive. Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/proxy/proxy_util.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=329849&r1=329848&r2=329849&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Mon Oct 31 08:31:29 2005 @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) mod_proxy_balancer: When finding best worker, use case insensitive + match for scheme and host, but case sensitive for the rest of + the path. [Jim Jagielski] + *) Asynchronous write completion for the Event MPM. [Brian Pane] *) Added an End-Of-Request bucket type. The logging of a request and Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=329849&r1=329848&r2=329849&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original) +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Oct 31 08:31:29 2005 @@ -1216,6 +1216,7 @@ int max_match = 0; int url_length; int worker_name_length; + int sh_length; const char *c; int i; @@ -1224,6 +1225,18 @@ return NULL; url_length = strlen(url); + + /* + * We need to find the start of the path and + * therefore we know the length of the scheme://hostname/ + * part. + */ + c = ap_strchr_c(c+3, '/'); + if (c) + sh_length = c - url; + else + sh_length = url_length; + worker = (proxy_worker *)conf->workers->elts; /* @@ -1231,9 +1244,22 @@ * fits best to the URL. */ for (i = 0; i < conf->workers->nelts; i++) { - if ( ((worker_name_length = strlen(worker->name)) <= url_length) + int prefix; + int bypass; + worker_name_length = strlen(worker->name); + if (worker_name_length <= sh_length) { + prefix = worker_name_length; + bypass = 1; + } else { + prefix = sh_length; + bypass = 0; + } + if ( (worker_name_length <= url_length) && (worker_name_length > max_match) - && (strncasecmp(url, worker->name, worker_name_length) == 0) ) { + && (strncasecmp(url, worker->name, prefix) == 0) + && (bypass || (strncmp(url + prefix, worker->name + prefix, + worker_name_length - prefix) == 0)) ) + { max_worker = worker; max_match = worker_name_length; }