billbarker    01/12/19 19:38:37

  Modified:    src/share/org/apache/tomcat/modules/generators
                        StaticInterceptor.java
  Log:
  Don't check dates if the static page is part of a jsp:include
  
  This was reported as Bug 5497 against 4.x.  In the report, it only happened because 
of a buggy browser, but there are still possible (if rare) for a servlet to set the 
Last-Modified header.  In any case, we can't send a 304 response even if we wanted to 
for an included page.
  
  Revision  Changes    Path
  1.16      +14 -11    
jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java
  
  Index: StaticInterceptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StaticInterceptor.java    2001/08/12 02:13:25     1.15
  +++ StaticInterceptor.java    2001/12/20 03:38:36     1.16
  @@ -299,21 +299,24 @@
        }
   
        File file = new File( absPath );
  -        MessageBytes imsMB=req.getMimeHeaders().getValue("If-Modified-Since");
  +     // If we are included, the If-Modified-Since isn't for us.
  +     if( ! res.isIncluded() ) {
  +         MessageBytes imsMB=req.getMimeHeaders().getValue("If-Modified-Since");
   
  -        if (imsMB != null) {
  +         if (imsMB != null) {
   
  -            long date = imsMB.getTime();
  +             long date = imsMB.getTime();
  +             
  +             if ((file.lastModified() <= (date + 1000)) ) {
  +                 // The entity has not been modified since the date
  +                 // specified by the client. This is not an error case.
  +                 context.getContextManager().handleStatus( req, res, 304);
  +                 return;
  +             }
   
  -            if ((file.lastModified() <= (date + 1000)) ) {
  -                // The entity has not been modified since the date
  -                // specified by the client. This is not an error case.
  -                context.getContextManager().handleStatus( req, res, 304);
  -                return;
  -            }
   
  -
  -        }
  +         }
  +     }
        if( debug>0) log( "After paranoic checks = " + absPath);
   
           String mimeType=ctx.getMimeMap().getContentTypeFor(absPath);
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to