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 2018/11/19 14:22:29 UTC

[3/6] httpcomponents-core git commit: Minor optimization

Minor optimization


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/746def49
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/746def49
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/746def49

Branch: refs/heads/ggregory-async-reverse-proxy-problem
Commit: 746def4965692193b149bc76bd2b091395957a09
Parents: 8104ce4
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Nov 19 14:12:42 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Nov 19 14:12:42 2018 +0100

----------------------------------------------------------------------
 .../hc/core5/http/nio/entity/BasicAsyncEntityProducer.java       | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/746def49/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
index 4cf0a08..03bbfac 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
@@ -128,7 +128,9 @@ public class BasicAsyncEntityProducer implements AsyncEntityProducer {
 
     @Override
     public final void produce(final DataStreamChannel channel) throws IOException {
-        channel.write(bytebuf);
+        if (bytebuf.hasRemaining()) {
+            channel.write(bytebuf);
+        }
         if (!bytebuf.hasRemaining()) {
             channel.endStream();
         }