You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/03/31 23:48:00 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util PrefixMapper.java

costin      01/03/31 13:48:00

  Modified:    src/share/org/apache/tomcat/util PrefixMapper.java
  Log:
  Fix for #1127 - host name is case insensitive.
  
  Revision  Changes    Path
  1.9       +11 -7     jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java
  
  Index: PrefixMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PrefixMapper.java	2001/02/20 03:14:10	1.8
  +++ PrefixMapper.java	2001/03/31 21:48:00	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v 1.8 2001/02/20 03:14:10 costin Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/02/20 03:14:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/PrefixMapper.java,v 1.9 2001/03/31 21:48:00 costin Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/03/31 21:48:00 $
    *
    * ====================================================================
    *
  @@ -84,6 +84,7 @@
    */
   public class PrefixMapper {
       // host -> PrefixMapper for virtual hosts
  +    // hosts are stored in lower case ( the "common" case )
       SimpleHashtable vhostMaps=new SimpleHashtable();
   
   
  @@ -117,15 +118,12 @@
       public void setMapCache( boolean v ) {
   	mapCacheEnabled=v;
       }
  -    
  -//     public void removeMapping( String host, String path ) {
  -// 	// XXX not implemented
  -//     }
   
       /** Remove all mappings matching path
        */
       public void removeAllMappings( String host, String path ) {
   	PrefixMapper vmap=this;
  +	host=host.toLowerCase();
   	if( host!=null ) {
   	    vmap=(PrefixMapper)vhostMaps.get(host);
   	}
  @@ -167,6 +165,7 @@
   	if( host == null )
   	    prefixMappedServlets.put( path, target);
   	else {
  +	    host=host.toLowerCase();
   	    PrefixMapper vmap=(PrefixMapper)vhostMaps.get( host );
   	    if( vmap == null ) {
   		vmap=new PrefixMapper();
  @@ -183,6 +182,7 @@
   	if( host==null )
   	    exactMappedServlets.put( path, target);
   	else {
  +	    host=host.toLowerCase();
   	    PrefixMapper vmap=(PrefixMapper)vhostMaps.get( host );
   	    if( vmap == null ) {
   		vmap=new PrefixMapper();
  @@ -209,6 +209,10 @@
   	PrefixMapper myMap=null;
   	if( host!=null )
   	    myMap=(PrefixMapper)vhostMaps.get( host );
  +	if( myMap==null ) {
  +	    myMap=(PrefixMapper)vhostMaps.get( host.toLowerCase() );
  +	}
  +	
   	if( myMap==null ) myMap = this; // default server