You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/02/18 03:40:22 UTC

DO NOT REPLY [Bug 6515] New: - tomcat sets response headers in sub request

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6515>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6515

tomcat sets response headers in sub request

           Summary: tomcat sets response headers in sub request
           Product: Tomcat 3
           Version: 3.3 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: paul.fu@ssmb.com.au


In respect to included content, Section 8.3 of the servlet 2.2 specification
states: "The included servlet cannot set headers or call any method that affects
the headers of the response. Any attempt to do so should be ignored."

In the FileHandler class of
org.apache.tomcat.modules.generators.StaticInterceptor, the response headers for
content type, content length and date are always set, even if it is a
sub-request - the setting of the response headers should be conditional on the
request being a top level request

In the 3.3.x nightly builds, the following patch needs to be applied.
--- src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java     
Fri Feb 15 22:23:08 2002
+++ StaticInterceptor.java      Mon Feb 18 13:36:38 2002
@@ -324,6 +324,7 @@
 
        File file = new File( absPath );
        // If we are included, the If-Modified-Since isn't for us.
+       // Nor is the setting of response headers
        if( ! res.isIncluded() ) {
            MessageBytes imsMB=req.getMimeHeaders().getValue("If-Modified-Since");
 
@@ -340,20 +341,20 @@
 
 
            }
-       }
-       if( debug>0) log( "After paranoic checks = " + absPath);
+           if( debug>0) log( "After paranoic checks = " + absPath);
 
-        String mimeType=ctx.getMimeMap().getContentTypeFor(absPath);
+            String mimeType=ctx.getMimeMap().getContentTypeFor(absPath);
 
-       if (mimeType == null) {
-           mimeType = "text/plain";
-       }
-       if( debug>0) log( "Serving  " + absPath);
+           if (mimeType == null) {
+               mimeType = "text/plain";
+           }
+           if( debug>0) log( "Serving  " + absPath);
 
-       res.setContentType(mimeType);
-       res.setContentLength((int)file.length());
+           res.setContentType(mimeType);
+           res.setContentLength((int)file.length());
 
-       setDateHeader(res, "Last-Modified", file.lastModified());
+           setDateHeader(res, "Last-Modified", file.lastModified());
+       }
 
        FileInputStream in=null;
        try {

// end patch

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>