tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Tucker" <dtuc...@eai.com>
Subject Bug - Infinite Loop in PrefixManager.java
Date Fri, 22 Sep 2000 01:27:20 GMT
While running some tests with TomCat, I uncovered an infinite loop in
PrefixManager.java.

The routine getLongestPrefixMatch has the following chunk of code:

	while (s.length() >= 0) {
	    //if(debug>8) context.log( "Prefix: " + s  );
	    container = myMap.prefixMappedServlets.get(s);

	    if (container == null) {
		s=URLUtil.removeLast( s );
	    }  else {
		if( myMap.mapCacheEnabled ) {
		    // XXX implement LRU or another replacement alghoritm
		    myMap.mapCache.put( path, container );
		}
		return container;
	    }
	}
	return container;
    }

The problem is that if myMap.prefixMappedServlet.get(s) never finds a
container, the code goes into an infinite loop:

I changed the while statement to:

	while (s.length() > 0) {

and at least it exited and threw an execption.

This situation occurred when I had a servlet mapped to a URL /myurl but then
used a custom application going through a proxy server that changed the url:
https://www.xxx.com/myurl  to http://www.xxx.com:443/myurl


Anyway, that was the situation. Could someone apply this fix to TomCat 3.2
beta 4?

Thanks,
Dave Tucker

----------------------------------------------------------
David Tucker                |  Engineering Animation, Inc
Principal Software Engineer |  2321 North Loop Drive
dtucker@eai.com             |  Ames, IA 50010
(515) 296-7138              |  www.eai.com
----------------------------------------------------------



Mime
View raw message