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 2022/10/16 14:48:49 UTC
[httpcomponents-core] branch 5.1.x updated: Bug fix: fixed incorrect calculation of the capacity increment in StringAsyncEntityConsumer
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/5.1.x by this push:
new 401766964 Bug fix: fixed incorrect calculation of the capacity increment in StringAsyncEntityConsumer
401766964 is described below
commit 4017669646276503487e3a450d5bc2ee59b24972
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sun Oct 16 13:06:20 2022 +0200
Bug fix: fixed incorrect calculation of the capacity increment in StringAsyncEntityConsumer
---
.../org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java
index 275fce5e3..e4e755814 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/StringAsyncEntityConsumer.java
@@ -70,7 +70,8 @@ public class StringAsyncEntityConsumer extends AbstractCharAsyncEntityConsumer<S
@Override
protected int capacityIncrement() {
- return capacityIncrement;
+ final int available = content.capacity() - content.length();
+ return Math.max(capacityIncrement, available);
}
@Override