larryi      01/07/10 22:24:15

  Modified:    src/share/org/apache/tomcat/core Tag: tomcat_32
                        ContextManager.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
  No                   revision
  
  
  No                   revision
  
  
  1.100.2.25 +5 -3      
jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.100.2.24
  retrieving revision 1.100.2.25
  diff -u -r1.100.2.24 -r1.100.2.25
  --- ContextManager.java       2001/07/06 18:40:05     1.100.2.24
  +++ ContextManager.java       2001/07/11 05:24:14     1.100.2.25
  @@ -1047,7 +1047,7 @@
        if( debug>0 )
            ctx.log( "Handler " + errorServlet + " " + errorPath);
   
  -        if ( statusLoop( ctx, req ) ){
  +        if ( statusLoop( ctx, req, code ) ){
               log( "Error loop for " + req + " error code " + code);
               return;
           }
  @@ -1206,8 +1206,10 @@
   
       /** 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"));
  
  
  

Reply via email to