You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2016/11/16 13:34:28 UTC

svn commit: r1769975 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11OutputBuffer.java webapps/docs/changelog.xml

Author: violetagg
Date: Wed Nov 16 13:34:27 2016
New Revision: 1769975

URL: http://svn.apache.org/viewvc?rev=1769975&view=rev
Log:
Ensure the response headers' buffer limit is reset to the capacity of this buffer when IOException occurs while writing the headers to the socket.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1769975&r1=1769974&r2=1769975&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Wed Nov 16 13:34:27 2016
@@ -244,7 +244,7 @@ public class Http11OutputBuffer implemen
      * headers so the error response can be written.
      */
     void resetHeaderBuffer() {
-        headerBuffer.position(0);
+        headerBuffer.position(0).limit(headerBuffer.capacity());
     }
 
 
@@ -272,7 +272,7 @@ public class Http11OutputBuffer implemen
         // Recycle response object
         response.recycle();
         // Reset pointers
-        headerBuffer.position(0);
+        headerBuffer.position(0).limit(headerBuffer.capacity());
         lastActiveFilter = -1;
         responseFinished = false;
         byteCount = 0;
@@ -325,8 +325,11 @@ public class Http11OutputBuffer implemen
         if (headerBuffer.position() > 0) {
             // Sending the response header buffer
             headerBuffer.flip();
-            socketWrapper.write(isBlocking(), headerBuffer);
-            headerBuffer.position(0).limit(headerBuffer.capacity());
+            try {
+                socketWrapper.write(isBlocking(), headerBuffer);
+            } finally {
+                headerBuffer.position(0).limit(headerBuffer.capacity());
+            }
         }
     }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1769975&r1=1769974&r2=1769975&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Nov 16 13:34:27 2016
@@ -76,6 +76,15 @@
       </update>
     </changelog>
   </subsection>
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        <bug>60372</bug>: Ensure the response headers' buffer limit is reset to
+        the capacity of this buffer when IOException occurs while writing the
+        headers to the socket. (violetagg)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Tribes">
     <changelog>
       <fix>



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