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 2019/10/16 10:26:25 UTC

[httpcomponents-core] 02/02: Bug fix: H2 protocol handler does not update global connection output window in some cases

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch bug-fixes
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 3bd8cf661af26c1cc5a6867b4ccf29d31ec45500
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Oct 16 12:15:50 2019 +0200

    Bug fix: H2 protocol handler does not update global connection output window in some cases
---
 .../hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java
index 17002ec..9ebfaf4 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java
@@ -370,9 +370,11 @@ abstract class AbstractH2StreamMultiplexer implements Identifiable, HttpConnecti
             final int streamWinSize = inputWindow.get();
             final int remainingCapacity = Integer.MAX_VALUE - streamWinSize;
             final int chunk = Math.min(inputCapacity, remainingCapacity);
-            final RawFrame windowUpdateFrame = frameFactory.createWindowUpdate(streamId, chunk);
-            commitFrame(windowUpdateFrame);
-            updateInputWindow(streamId, inputWindow, chunk);
+            if (chunk != 0) {
+                final RawFrame windowUpdateFrame = frameFactory.createWindowUpdate(streamId, chunk);
+                commitFrame(windowUpdateFrame);
+                updateInputWindow(streamId, inputWindow, chunk);
+            }
         }
     }
 
@@ -1379,6 +1381,7 @@ abstract class AbstractH2StreamMultiplexer implements Identifiable, HttpConnecti
             if (remoteEndStream) {
                 return;
             }
+            incrementInputCapacity(0, connInputWindow, increment);
             incrementInputCapacity(id, inputWindow, increment);
         }