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 Mon, 04 Feb 2002 15:44:48 GMT
That's not necessary Adrian,

I bet you have an examples directory in your Apache document root.  When I
create such a directory, I get the behavior you are talking about.  The
following most likely happens:

1) Submittal of uri /examples to Apache
2) Apache asks mod_webapp if it will handle this uri
3) mod_webapp declines
4) Apache notices the examples directory in document root and rewrites uri
with trailing slash
5) Apache must then ask mod_webapp if it will handle this uri
6) mod_webapp accepts the uri.


Adrian,  change your WebAppDeploy to use /examples/ and I bet it still works
for you.

Marc.

-----Original Message-----
From: Adrian Caneva [mailto:acaneva@nexttech.com.ar]
Sent: Monday, February 04, 2002 9:34 AM
To: Tomcat Users List
Subject: RE: Apache/WARP connector/trailing slash

Hi Marc,
I am using :
#WebAppDeploy examples warpConnection /examples and it works fine.
If as you stated TC is looking for URL "/../", I can only think that it is
working because my Apache (1.3.22) is somehow adding the trailing slash when
not found.
I dont't know if there is a simple configuration in httpd.conf to get this
automatic redirection to work or is a 1.3.22 issue.
You can can send me your httpd.conf, if you like, and I'll try to find the
differences.

best regards,

==========================
  Adrian Caneva
  NEXT TECHNOLOGY SRL
  La Rioja 26
  (T4000ISB) Tucuman
  Tel/Fax +54 381 4219105
  acaneva@nexttech.com.ar
  www.nexttech.com.ar
==========================

-----Original Message-----
From: Marc Ostrow [mailto:marc@twinquest.com]
Sent: Domingo, 03 de Febrero de 2002 08:10 p.m.
To: Tomcat Users List
Subject: Re: Apache/WARP connector/trailing slash


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>



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


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