https://issues.apache.org/bugzilla/show_bug.cgi?id=48381

           Summary: Hostnames in the <Host> section are converted to lower
                    case
           Product: Tomcat 6
           Version: 6.0.20
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: jens.a...@web.de


Created an attachment (id=24700)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24700)
Webapp for demonstrating the bug

Overview:
If the attribute name in the <Host> configuration contains upper case letters
and you use a case-sensitive file system than the configuration files are
looked up in the wrong directory (hostname converted to lower case)

RFC 1035 (DNS) says in section 2.3.1.:
Note that while upper and lower case letters are allowed in domain
names, no significance is attached to the case.  That is, two names with
the same spelling but different case are to be treated as if identical.

Let us suppose we have this configuration in the server.xml:

<Engine name="Catalina" defaultHost="Tux">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="Tux"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
</Engine>

The expected behavior is, that the configuration files are searched under
$CATALINA_BASE/conf/[engine_name]/[host_name] which is in our case
$CATALINA_BASE/conf/Catalina/Tux

Instead Tomcat converts silently Tux to tux and searches under
$CATALINA_BASE/conf/Catalina/tux

Steps to reproduce:
1. Configure the server.xml with a hostname which contains upper case letters.
See above.
2. Deploy the webapp tomcatbug
   cd webapps
   unzip tomcatbug.zip
   cd tomcatbug
   ant all
3. Create a file $CATALINA_BASE/conf/Catalina/Tux/tomcatbug.xml with this
content
   <Context>
    <Resource name="bean/MyBeanFactory" auth="Container"
            type="MyBean"
            factory="org.apache.naming.factory.BeanFactory"
            bar="23"/> 
   </Context>
4. Start tomcat and browse to http://Tux:8080/tomcatbug/TomcatBug

Actual result:
<html>
<head>
<title>Tomcat Bug</title>
</head>
<body>
<h1>Tomcat Bug</h1>
javax.naming.NamingException: Cannot create resource instance
    at
org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:114)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at TomcatBug.doGet(TomcatBug.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Thread.java:619)
</body>
</html>

Expected result:
<html>
<head>
<title>Tomcat Bug</title>
</head>
<body>
<h1>Tomcat Bug</h1>
foo = Default Foo, bar = 23
</body>
</html>

As a workaround you should not use upper case letters in hostnames. 
This should be written in the documentation.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to