Author: markt
Date: Wed Mar 20 22:35:31 2013
New Revision: 1459085

URL: http://svn.apache.org/r1459085
Log:
Ensure HEAD requests return the correct content length when the requested 
resource uses a Writer.
Patch by Nick Williams.

Modified:
    tomcat/trunk/java/javax/servlet/http/HttpServlet.java

Modified: tomcat/trunk/java/javax/servlet/http/HttpServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServlet.java?rev=1459085&r1=1459084&r2=1459085&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpServlet.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpServlet.java Wed Mar 20 22:35:31 
2013
@@ -750,8 +750,12 @@ class NoBodyResponse extends HttpServlet
 
     // file private
     void setContentLength() {
-        if (!didSetContentLength)
-          super.setContentLength(noBody.getContentLength());
+        if (!didSetContentLength) {
+            if (writer != null) {
+                writer.flush();
+            }
+            super.setContentLength(noBody.getContentLength());
+        }
     }
 
 



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

Reply via email to