carterkozak commented on a change in pull request #216:
URL: 
https://github.com/apache/httpcomponents-core/pull/216#discussion_r469651855



##########
File path: 
httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
##########
@@ -147,13 +149,20 @@ protected OutputStream createContentOutputStream(
         if (len >= 0) {
             return new ContentLengthOutputStream(buffer, outputStream, len);
         } else if (len == ContentLengthStrategy.CHUNKED) {
-            final int chunkSizeHint = http1Config.getChunkSizeHint() >= 0 ? 
http1Config.getChunkSizeHint() : 2048;
-            return new ChunkedOutputStream(buffer, outputStream, 
chunkSizeHint, trailers);
+            return new ChunkedOutputStream(buffer, outputStream, 
getChunkedRequestBuffer(), trailers);
         } else {
             return new IdentityOutputStream(buffer, outputStream);
         }
     }
 
+    private byte[] getChunkedRequestBuffer() {
+        if (chunkedRequestBuffer == null) {
+            final int chunkSizeHint = this.http1Config.getChunkSizeHint();
+            chunkedRequestBuffer = new byte[chunkSizeHint > 0 ? chunkSizeHint 
: 8192];

Review comment:
       I think this should still be `>= 0` to avoid changing behavior when zero 
is set, allowing each write to produce a chunk.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to