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/09/28 16:50:53 UTC

[3/3] httpcomponents-core git commit: Consistent use of chunk size hint parameter by HTTP/1.1 protocol handler

Consistent use of chunk size hint parameter by HTTP/1.1 protocol handler


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

Branch: refs/heads/master
Commit: 31be6d63a6aceea0f9fee5ad80601dda26d05920
Parents: 5e3bd0e
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Fri Sep 28 15:04:02 2018 +0200
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Fri Sep 28 18:46:39 2018 +0200

----------------------------------------------------------------------
 .../hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java      | 4 ++--
 .../hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java      | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/31be6d63/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
index 820ed7b..7b43f89 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamDuplexer.java
@@ -275,10 +275,10 @@ public class ClientHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
             final WritableByteChannel channel,
             final SessionOutputBuffer buffer,
             final BasicHttpTransportMetrics metrics) throws HttpException {
+        final int chunkSizeHint = h1Config.getChunkSizeHint() >= 0 ? h1Config.getChunkSizeHint() : 2048;
         if (len >= 0) {
-            return new LengthDelimitedEncoder(channel, buffer, metrics, len, h1Config.getChunkSizeHint());
+            return new LengthDelimitedEncoder(channel, buffer, metrics, len, chunkSizeHint);
         } else if (len == ContentLengthStrategy.CHUNKED) {
-            final int chunkSizeHint = h1Config.getChunkSizeHint() >= 0 ? h1Config.getChunkSizeHint() : 2048;
             return new ChunkEncoder(channel, buffer, metrics, chunkSizeHint);
         } else {
             throw new LengthRequiredException();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/31be6d63/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamDuplexer.java
----------------------------------------------------------------------
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 c652b3e..bfc02d0 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
@@ -274,13 +274,13 @@ public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpR
             final WritableByteChannel channel,
             final SessionOutputBuffer buffer,
             final BasicHttpTransportMetrics metrics) throws HttpException {
+        final int chunkSizeHint = h1Config.getChunkSizeHint() >= 0 ? h1Config.getChunkSizeHint() : 2048;
         if (len >= 0) {
-            return new LengthDelimitedEncoder(channel, buffer, metrics, len, h1Config.getChunkSizeHint());
+            return new LengthDelimitedEncoder(channel, buffer, metrics, len, chunkSizeHint);
         } else if (len == ContentLengthStrategy.CHUNKED) {
-            final int chunkSizeHint = h1Config.getChunkSizeHint() >= 0 ? h1Config.getChunkSizeHint() : 2048;
             return new ChunkEncoder(channel, buffer, metrics, chunkSizeHint);
         } else {
-            return new IdentityEncoder(channel, buffer, metrics, h1Config.getChunkSizeHint());
+            return new IdentityEncoder(channel, buffer, metrics, chunkSizeHint);
         }
     }