tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graff" <ph...@mindspring.com>
Subject Question on mod_webapp and WebAppDeployment semantics
Date Sun, 02 Dec 2001 23:48:52 GMT
I was reviewing the source code and operation of the mod_webapp library
module and noticed a little operational quirk..

I've seen a couple of messages relevant to this but nothing that really
gives me the correct answer.

In the Sun Servlet specification v2.3 section 4.4 describes the parts that
make up a Request URI.

The problem is this:

lines 81-88 of jakarta-tomcat-connectors/webapp/lib/wa_config.c does some
normalizing of the deployment URL path:

81    strncpy(buf,p,1024);
82    l=strlen(buf)-1;
83    if (buf[l]=='/') buf[l]='\0';
84    if (buf[0]=='/' || l==0) {
85      appl->rpth=apr_pstrcat(wa_pool,buf,"/",NULL);
86    } else {
87      appl->rpth=apr_pstrcat(wa_pool,"/",buf,"/",NULL);
88    }

In the case that the buffer is loaded with the correct application path
starting with '/' or if the application name is empty (indicating that this
is the ROOT context of the app server) a '/' is appended.  Unfortunately
this causes a requests to /someapp to fail with a 404 and /someapp/ to work
correctly provided that there is a welcome file list associated with the
application.  Applications like Tomcat's manager application choke on this,
as it's attempting to list the applications associated under '/' instead of
listing all the applications that are in the servlet.  The manager think's
your asking for anything with the servlet path '/', as the breakdown of the
request URI is:

- Context Path = "/manager" (assuming we've deployed the manager as
'/manager')
- Servlet Path = "/"
- Path Info = ""

If the above code snippet was changed to the following:
    strncpy(buf,p,1024);
    l=strlen(buf)-1;
    if (buf[l]=='/') buf[l]='\0';
    if(l == 0) {
      appl->rpth=apr_pstrcat(wa_pool, buf, NULL);
    } else if (buf[0]=='/') {
      appl->rpth=apr_pstrcat(wa_pool,buf,NULL);
    } else {
      appl->rpth=apr_pstrcat(wa_pool,"/",buf,NULL);
    }

I think it may solve the issue of application failure.




--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message