tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Ostrow" <m...@twinquest.com>
Subject Re: Apache/WARP connector/trailing slash
Date Sun, 03 Feb 2002 23:09:56 GMT
I wanted to know the same thing, so I went out and looked at the code base
to understand why.

USE OF THE FOLLOWING IS AT YOUR OWN RISK.  IN NO EVENT SHALL MYSELF AND/OR
TWINQUEST LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS INFORMATION/SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Ok, if you do not want to have to supply the trailing slash, you need to
keep the following in mind.  The webapp module attaches itself to Apache in
such a way that Apache asks the webapp module if it will handle or decline a
request that Apache receives.  For every request that Apache passes on to
the webapp module, the webapp module searches its list of applications to
see if it will handle the request. The slower this matching process is, the
slower Apache becomes.

I got this to work using the source distribution
webapp-module-1.0.1-tc401-src.tar.gz.  Mind you, I'm on Mac OS X, but that
shouldn't matter any bit.  Take a good look at the wam_match() function in
mod_webapp.c found in jakarta-tomcat-connectors/webapp/apache-1.3.  You will
notice that the requested uri is compared against the WebAppDeploy's request
path.  Note that when the WebAppDeploy directive is processed, the request
path is normalized to begin with '/' and end with '/'.  So it doesn't matter
whether you have

WebAppDeploy examples warpConnection /examples
Or	WebAppDeploy examples warpConnection /examples/

So if you do not want to have to type the trailing slash, you could modify
the wam_match() function to allow this.

I didn't spend that much time with this, but it currently SEEMS to be
working (I performed hardly any testing!!!)  The details of what I changed
follow:

I changed

    elem=host->apps;
    while(elem!=NULL) {
        appl=(wa_application *)elem->curr;
        if (strncmp(appl->rpth,r->uri,strlen(appl->rpth))==0) break;

        appl=NULL;
        elem=elem->next;
    }
    if (appl==NULL) return(DECLINED);

to look like this

    elem=host->apps;
    while(elem!=NULL) {
        register int slen;

        appl=(wa_application *)elem->curr;
        slen = strlen(appl->rpth);

        if( strncmp( appl->rpth, r->uri, slen) == 0 ) break;
        if( slen >= 2 && strncmp( appl->rpth, r->uri, slen - 1 ) == 0 )
break;

        appl=NULL;
        elem=elem->next;
    }
    if (appl==NULL) return(DECLINED);



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message