You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/03/07 09:11:31 UTC

[httpcomponents-core] branch bug-fixes created (now e605bfc)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch bug-fixes
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git.


      at e605bfc  Bug fix: HTTP/1.1 stream duplexer when being in the graceful shutdown state can have null output handler

This branch includes the following new commits:

     new 055a1ec  Bug fix: basic entity consumers to clear buffered content when releasing resources
     new e605bfc  Bug fix: HTTP/1.1 stream duplexer when being in the graceful shutdown state can have null output handler

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[httpcomponents-core] 01/02: Bug fix: basic entity consumers to clear buffered content when releasing resources

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch bug-fixes
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 055a1eccde926c3489eebf4a543a514418024d0b
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Mar 7 09:25:35 2019 +0100

    Bug fix: basic entity consumers to clear buffered content when releasing resources
---
 .../org/apache/hc/core5/testing/nio/Http1IntegrationTest.java    | 9 ++++++++-
 .../hc/core5/http/nio/entity/BasicAsyncEntityConsumer.java       | 1 +
 .../hc/core5/http/nio/entity/StringAsyncEntityConsumer.java      | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
index bb23dee..11d3a3b 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
@@ -1425,7 +1425,14 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
         final ClientSessionEndpoint streamEndpoint = connectFuture.get();
 
         final AsyncRequestProducer requestProducer = new BasicRequestProducer("GET", createRequestURI(serverEndpoint, "/hello"));
-        final StringAsyncEntityConsumer entityConsumer = new StringAsyncEntityConsumer();
+        final StringAsyncEntityConsumer entityConsumer = new StringAsyncEntityConsumer() {
+
+            @Override
+            public void releaseResources() {
+                // Do not clear internal content buffer
+            }
+
+        };
         final BasicResponseConsumer<String> responseConsumer = new BasicResponseConsumer<>(entityConsumer);
         final Future<Message<HttpResponse, String>> future1 = streamEndpoint.execute(requestProducer, responseConsumer, null);
         try {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityConsumer.java
index cc21c9d..26487ec 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityConsumer.java
@@ -79,6 +79,7 @@ public class BasicAsyncEntityConsumer extends AbstractBinAsyncEntityConsumer<byt
 
     @Override
     public void releaseResources() {
+        buffer.clear();
     }
 
 }
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java
index 6475cbf..e1019af 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java
@@ -80,6 +80,7 @@ public class StringAsyncEntityConsumer extends AbstractCharAsyncEntityConsumer<S
 
     @Override
     public void releaseResources() {
+        content.clear();
     }
 
 }


[httpcomponents-core] 02/02: Bug fix: HTTP/1.1 stream duplexer when being in the graceful shutdown state can have null output handler

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch bug-fixes
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit e605bfc490021ac0eb1b71e0965738b470dde303
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Mar 7 10:00:51 2019 +0100

    Bug fix: HTTP/1.1 stream duplexer when being in the graceful shutdown state can have null output handler
---
 .../org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
index 407791f..e187e35 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
@@ -368,8 +368,9 @@ public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
 
     @Override
     void produceOutput() throws HttpException, IOException {
-        Asserts.notNull(outgoing, "Response stream handler");
-        outgoing.produceOutput();
+        if (outgoing != null) {
+            outgoing.produceOutput();
+        }
     }
 
     @Override