You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/06/30 11:43:19 UTC

svn commit: r1750774 - /tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

Author: markt
Date: Thu Jun 30 11:43:18 2016
New Revision: 1750774

URL: http://svn.apache.org/viewvc?rev=1750774&view=rev
Log:
Remove duplicate committed flag from HTTP/1.1 OutputBuffer and use the flag on the response (like AJP and HTTP/2 do)

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

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=1750774&r1=1750773&r2=1750774&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Jun 30 11:43:18 2016
@@ -60,12 +60,6 @@ public class Http11OutputBuffer implemen
 
 
     /**
-     * Committed flag.
-     */
-    protected boolean committed;
-
-
-    /**
      * Finished flag.
      */
     protected boolean finished;
@@ -129,7 +123,6 @@ public class Http11OutputBuffer implemen
         activeFilters = new OutputFilter[0];
         lastActiveFilter = -1;
 
-        committed = false;
         finished = false;
 
         outputStreamOutputBuffer = new SocketOutputBuffer();
@@ -200,7 +193,7 @@ public class Http11OutputBuffer implemen
     @Override
     public int doWrite(ByteChunk chunk) throws IOException {
 
-        if (!committed) {
+        if (!response.isCommitted()) {
             // Send the connector a request for commit. The connector should
             // then validate the headers, send them (using sendHeaders) and
             // set the filters accordingly.
@@ -258,7 +251,7 @@ public class Http11OutputBuffer implemen
      */
     public void reset() {
 
-        if (committed) {
+        if (response.isCommitted()) {
             throw new IllegalStateException(sm.getString("iob.illegalreset"));
         }
 
@@ -295,7 +288,6 @@ public class Http11OutputBuffer implemen
         // Reset pointers
         pos = 0;
         lastActiveFilter = -1;
-        committed = false;
         finished = false;
         byteCount = 0;
     }
@@ -327,7 +319,7 @@ public class Http11OutputBuffer implemen
 
 
     public void sendAck() throws IOException {
-        if (!committed) {
+        if (!response.isCommitted()) {
             socketWrapper.write(isBlocking(), Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
             if (flushBuffer(true)) {
                 throw new IOException(sm.getString("iob.failedwrite.ack"));
@@ -342,8 +334,6 @@ public class Http11OutputBuffer implemen
      * @throws IOException an underlying I/O error occurred
      */
     protected void commit() throws IOException {
-        // The response is now committed
-        committed = true;
         response.setCommitted(true);
 
         if (pos > 0) {



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