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



##########
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:
       On second review this matches the logic in ChunkedOutputStream which 
used the default buffer size when chunkSizeHint was set to zero.




----------------------------------------------------------------
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