billbarker 2004/02/06 21:54:32
Modified: catalina/src/share/org/apache/catalina/realm RealmBase.java
Log:
Went back and re-read the spec.
A url-pattern of /protected/* must match a request for /protected. Hence a special case for this one.
Revision Changes Path
1.29 +8 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java
Index: RealmBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- RealmBase.java 7 Feb 2004 05:24:08 -0000 1.28
+++ RealmBase.java 7 Feb 2004 05:54:32 -0000 1.29
@@ -511,7 +511,10 @@
matched = true;
length = pattern.length();
} else if(pattern.regionMatches(0,uri,0,
- pattern.length()-1)) {
+ pattern.length()-1) ||
+ (pattern.length()-2 == uri.length() &&
+ pattern.regionMatches(0,uri,0,
+ pattern.length()-2))) {
matched = true;
length = pattern.length();
}
The algortihm from ApplicationFilterFactory is:
// Case 2 - Path Match ("/.../*")
if (testPath.equals("/*"))
return (true);
if (testPath.endsWith("/*")) {
if (testPath.regionMatches(0, requestPath, 0,
testPath.length() - 2)) {
if (requestPath.length() == (testPath.length() - 2)) {
return (true);
} else if ('/' == requestPath.charAt(testPath.length() - 2)) {
return (true);
}
}
return (false);
}
I believe these two should be equivalent now, which is good, but for clarity we should (IMO) use the same. Mine would be less efficient possibly but is probably easier to understand. Obviously, as long as it works, we're fine :)
Rémy
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]