tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6515] New: - tomcat sets response headers in sub request
Date Mon, 18 Feb 2002 02:40:22 GMT
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:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message