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 2025/09/09 08:51:45 UTC

(httpcomponents-core) branch master updated: Regression: Improved H2 connection termination in case of the opposite endpoint failing to send GOAWAY frame (corrected)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4b79b5dd4 Regression: Improved H2 connection termination in case of the opposite endpoint failing to send GOAWAY frame (corrected)
4b79b5dd4 is described below

commit 4b79b5dd4928a9174b590d12a2aa93a7f3819538
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Mon Sep 8 11:45:36 2025 +0200

    Regression: Improved H2 connection termination in case of the opposite endpoint failing to send GOAWAY frame (corrected)
---
 .../http2/impl/nio/AbstractH2StreamMultiplexer.java  | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 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 6241eb4f6..dbeb501d7 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
@@ -458,18 +458,22 @@ public final void onInput(final ByteBuffer src) throws HttpException, IOExceptio
         } else {
             for (;;) {
                 final RawFrame frame = inputBuffer.read(src, ioSession);
-                if (frame == null) {
-                    if (inputBuffer.isEndOfStream() && connState == ConnectionHandshake.ACTIVE) {
+                if (frame != null) {
+                    if (streamListener != null) {
+                        streamListener.onFrameInput(this, frame.getStreamId(), frame);
+                    }
+                    consumeFrame(frame);
+                } else {
+                    if (inputBuffer.isEndOfStream()) {
+                        if (connState == ConnectionHandshake.ACTIVE) {
+                            final RawFrame goAway = frameFactory.createGoAway(processedRemoteStreamId, H2Error.NO_ERROR, "Unexpected end of stream");
+                            commitFrame(goAway);
+                        }
                         connState = ConnectionHandshake.SHUTDOWN;
-                        final RawFrame goAway = frameFactory.createGoAway(processedRemoteStreamId, H2Error.NO_ERROR, "Unexpected end of stream");
-                        commitFrame(goAway);
+                        requestSessionOutput();
                     }
                     break;
                 }
-                if (streamListener != null) {
-                    streamListener.onFrameInput(this, frame.getStreamId(), frame);
-                }
-                consumeFrame(frame);
             }
         }
     }