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 13846] - If-Modified-Since results in incorrect headers
Date Wed, 02 Jul 2003 18:49:43 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=13846>.
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=13846

If-Modified-Since results in incorrect headers

puckman@taglab.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.1.12                      |4.1.24



------- Additional Comments From puckman@taglab.com  2003-07-02 18:49 -------
I know more about this problem now:

The problem is twofold, Content-Length set to 0 the blame goes to Tomcat 4
Coyote/JK, however the Content-Type set to text/plain the problem lies with
apache 1.3.x. If a response does not have a "Content-Type" set, apache 1.3 adds
its' DefaultType directive even if the response is a 304.

The easy option is to let Tomcat 4 always set both headers correctly in a 304,
and then apache DefaultType is not an issue.

$ diff -u DefaultServlet.java-2003-07-01 DefaultServlet.java
--- DefaultServlet.java-2003-07-01      2003-03-19 09:20:48.000000000 +0000
+++ DefaultServlet.java 2003-07-02 19:45:32.000000000 +0100
@@ -972,6 +972,16 @@
                 (request.getAttribute(Globals.CONTEXT_PATH_ATTR) != null);
             if (!included
                 && !checkIfHeaders(request, response, resourceInfo)) {
+
+             // Added by Martin Algesten 1/7 2003 to make sure the
+             // Content-Type/Content-Length doesn't get polluted
+             // in the mod_proxy cache.
+               String contentType =
+                 getServletContext().getMimeType(resourceInfo.path);
+               response.setContentType( contentType );
+               long contentLength = resourceInfo.length;
+                response.setContentLength((int) contentLength);
+
                 return;
             }

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message