hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1675352 - in /httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src: main/java/org/apache/http/impl/nio/ main/java/org/apache/http/nio/protocol/ test/java/org/apache/http/impl/nio/ test/java/org/apache/http/nio/protocol/
Date Wed, 22 Apr 2015 12:54:55 GMT
Author: olegk
Date: Wed Apr 22 12:54:54 2015
New Revision: 1675352

URL: http://svn.apache.org/r1675352
Log:
HTTPCORE-399: DefaultNHttpClientConnection incorrectly suspends output

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?rev=1675352&r1=1675351&r2=1675352&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
Wed Apr 22 12:54:54 2015
@@ -307,9 +307,6 @@ public class DefaultNHttpClientConnectio
                     this.status = CLOSED;
                     resetOutput();
                 }
-                if (this.contentEncoder == null && this.status != CLOSED) {
-                    this.session.clearEvent(EventMask.WRITE);
-                }
             }
         } catch (final Exception ex) {
             handler.exception(this, ex);

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java?rev=1675352&r1=1675351&r2=1675352&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
Wed Apr 22 12:54:54 2015
@@ -175,6 +175,7 @@ public class HttpAsyncRequestExecutor im
 
         final HttpRequest request = handler.generateRequest();
         if (request == null) {
+            conn.suspendOutput();
             return;
         }
         final ProtocolVersion version = request.getRequestLine().getProtocolVersion();

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java?rev=1675352&r1=1675351&r2=1675352&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestDefaultNHttpClientConnection.java
Wed Apr 22 12:54:54 2015
@@ -188,7 +188,6 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
 
-        Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_WRITE);
         Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
     }
 
@@ -214,7 +213,6 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
 
-        Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_WRITE);
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
 
@@ -240,7 +238,6 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
 
-        Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_WRITE);
         Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
     }
 
@@ -266,7 +263,6 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
 
-        Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_WRITE);
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
 
@@ -351,7 +347,6 @@ public class TestDefaultNHttpClientConne
         Assert.assertEquals("POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" +
                 "5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(Consts.ASCII));
 
-        Mockito.verify(session, Mockito.times(1)).clearEvent(SelectionKey.OP_WRITE);
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
 

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java?rev=1675352&r1=1675351&r2=1675352&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
Wed Apr 22 12:54:54 2015
@@ -193,6 +193,7 @@ public class TestHttpAsyncRequestExecuto
         Mockito.verify(this.exchangeHandler).generateRequest();
         Assert.assertNull(state.getRequest());
 
+        Mockito.verify(this.conn, Mockito.times(1)).suspendOutput();
         Mockito.verify(this.conn, Mockito.never()).submitRequest(Mockito.<HttpRequest>any());
     }
 



Mime
View raw message