You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/12/11 21:44:35 UTC

DO NOT REPLY [Bug 48381] New: Hostnames in the section are converted to lower case

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.apel@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48381] Hostnames in the section are converted to lower case

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48381

--- Comment #2 from japel <je...@web.de> 2009-12-11 12:56:17 UTC ---
Created an attachment (id=24702)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24702)
Hoastnames are no longer lower case internally

This patch might have several side effects and the core developers 
most likely had their reasons for converting hostnames to lower case
internally.

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48381] Hostnames in the section are converted to lower case

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48381

--- Comment #1 from japel <je...@web.de> 2009-12-11 12:52:16 UTC ---
Created an attachment (id=24701)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24701)
This patch is for the documentation (use lower case hostnames)

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48381] Hostnames in the section are converted to lower case

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48381

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Mark Thomas <ma...@apache.org> 2009-12-13 15:09:01 GMT ---
Treating host names in a case sensitive manner is likely to break things and is
not consistent with RFC 1035.

I have updated the docs for trunk, 6.0.x and 5.5.x.

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org