larryi 01/07/10 22:19:50
Modified: src/share/org/apache/tomcat/modules/generators
ErrorHandler.java
Log:
Prior patch to fix recursive status handling went too far and broke
authorization which makes a recursive call to the status handling.
Modify to report a recursive loop only if recursion occurs with the same
status code.
Suggested by: Ignacio J. Ortega
Revision Changes Path
1.15 +6 -5
jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java
Index: ErrorHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ErrorHandler.java 2001/07/06 18:41:00 1.14
+++ ErrorHandler.java 2001/07/11 05:19:50 1.15
@@ -191,7 +191,7 @@
}
boolean isDefaultHandler = false;
- if ( statusLoop( ctx, req ) ){
+ if ( statusLoop( ctx, req, code ) ){
log( "Error loop for " + req + " error code " + code);
return;
}
@@ -399,11 +399,12 @@
/** Handle the case of status handler generating an error
*/
- private boolean statusLoop( Context ctx, Request req ) {
- if ( req.getAttribute("javax.servlet.error.status_code") != null ) {
+ private boolean statusLoop( Context ctx, Request req, int newCode ) {
+ Integer lastCode =
(Integer)req.getAttribute("javax.servlet.error.status_code");
+ // If status code repeated, assume recursive loop
+ if ( lastCode != null && lastCode.intValue() == newCode) {
if( ctx.getDebug() > 0 )
- ctx.log( "Error: nested error inside status servlet " +
- req.getAttribute("javax.servlet.error.status_code"));
+ ctx.log( "Error: nested error inside status servlet " + newCode);
return true;
}
return false;