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 13:37:30 UTC

[1/2] httpcomponents-core git commit: Minor optimization

Repository: httpcomponents-core
Updated Branches:
  refs/heads/master 93f61318f -> b6b71d90d


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/b6b71d90
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/b6b71d90
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/b6b71d90

Branch: refs/heads/master
Commit: b6b71d90da4fbcb978874c5ef6ff967706912221
Parents: 96c9dd8
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:32:32 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/b6b71d90/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();
         }


[2/2] httpcomponents-core git commit: Fixed incorrect thread synchronization in an HTTP/1.1 integration test

Posted by ol...@apache.org.
Fixed incorrect thread synchronization in an HTTP/1.1 integration test


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

Branch: refs/heads/master
Commit: 96c9dd8387c181f01ab42174482b9ebef5745f96
Parents: 93f6131
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Nov 19 14:12:22 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Nov 19 14:32:32 2018 +0100

----------------------------------------------------------------------
 .../org/apache/hc/core5/testing/nio/Http1IntegrationTest.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/96c9dd83/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
----------------------------------------------------------------------
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 a97f558..3661a80 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
@@ -821,7 +821,9 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                                             responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE), context);
                                         }
                                         final HttpResponse response = new BasicHttpResponse(200);
-                                        responseChannel.sendResponse(response, entityProducer, context);
+                                        synchronized (entityProducer) {
+                                            responseChannel.sendResponse(response, entityProducer, context);
+                                        }
                                     }
                                 } catch (final Exception ignore) {
                                     // ignore