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

rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new b3a946c154 Revert "Refactor for consistency"
b3a946c154 is described below

commit b3a946c1540c0b8b6598752376d42d0f0185afe0
Author: remm <[email protected]>
AuthorDate: Tue May 19 22:54:02 2026 +0200

    Revert "Refactor for consistency"
    
    This reverts commit 84ec02c3fb2117d158e2b677da6338af7a48033b.
---
 java/org/apache/coyote/http2/Http2AsyncParser.java | 36 +++++++---------------
 .../coyote/http2/Http2AsyncUpgradeHandler.java     |  2 +-
 2 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java 
b/java/org/apache/coyote/http2/Http2AsyncParser.java
index a54a31da45..e1c8170765 100644
--- a/java/org/apache/coyote/http2/Http2AsyncParser.java
+++ b/java/org/apache/coyote/http2/Http2AsyncParser.java
@@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
 import jakarta.servlet.http.WebConnection;
 
 import org.apache.coyote.ProtocolException;
-import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.SocketEvent;
 import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.net.SocketWrapperBase.BlockingMode;
@@ -34,15 +33,16 @@ import 
org.apache.tomcat.util.net.SocketWrapperBase.CompletionState;
 
 class Http2AsyncParser extends Http2Parser {
 
-    private final AsyncOutput output;
     private final SocketWrapperBase<?> socketWrapper;
+    private final Http2AsyncUpgradeHandler upgradeHandler;
     private volatile Throwable error = null;
 
-    Http2AsyncParser(String connectionId, Input input, Output output, 
SocketWrapperBase<?> socketWrapper) {
+    Http2AsyncParser(String connectionId, Input input, Output output, 
SocketWrapperBase<?> socketWrapper,
+            Http2AsyncUpgradeHandler upgradeHandler) {
         super(connectionId, input, output);
         this.socketWrapper = socketWrapper;
         socketWrapper.getSocketBufferHandler().expand(input.getMaxFrameSize());
-        this.output = (AsyncOutput) output;
+        this.upgradeHandler = upgradeHandler;
     }
 
 
@@ -121,12 +121,13 @@ class Http2AsyncParser extends Http2Parser {
                     socketWrapper.unRead(payload);
                 }
                 // Finish processing the connection
-                output.processConnectionCallback(webConnection, stream);
+                upgradeHandler.processConnectionCallback(webConnection, 
stream);
             } else {
-                output.closeConnection(new 
ConnectionException(error.getMessage(), Http2Error.PROTOCOL_ERROR, error));
+                upgradeHandler
+                        .closeConnection(new 
ConnectionException(error.getMessage(), Http2Error.PROTOCOL_ERROR, error));
             }
             // Continue reading frames
-            output.upgradeDispatch(SocketEvent.OPEN_READ);
+            upgradeHandler.upgradeDispatch(SocketEvent.OPEN_READ);
         }
     }
 
@@ -283,7 +284,7 @@ class Http2AsyncParser extends Http2Parser {
                                     readUnknownFrame(streamId, frameTypeId, 
flags, payloadSize, payload);
                             }
                         }
-                        if (!output.isOverheadLimitExceeded()) {
+                        if (!upgradeHandler.isOverheadLimitExceeded()) {
                             // See if there is a new 9 byte header and 
continue parsing if possible
                             if (payload.remaining() >= 9) {
                                 int position = payload.position();
@@ -321,7 +322,7 @@ class Http2AsyncParser extends Http2Parser {
             if (state == CompletionState.DONE) {
                 // The call was not completed inline, so must start reading 
new frames
                 // or process the stream exception
-                output.upgradeDispatch(SocketEvent.OPEN_READ);
+                upgradeHandler.upgradeDispatch(SocketEvent.OPEN_READ);
             }
         }
 
@@ -333,25 +334,10 @@ class Http2AsyncParser extends Http2Parser {
                 log.debug(sm.getString("http2Parser.error", connectionId, 
Integer.valueOf(streamId), frameType), e);
             }
             if (state == null || state == CompletionState.DONE) {
-                output.upgradeDispatch(SocketEvent.ERROR);
+                upgradeHandler.upgradeDispatch(SocketEvent.ERROR);
             }
         }
 
     }
 
-    /**
-     * Interface that must be implemented to receive notifications from the 
parser as it processes incoming frames.
-     */
-    interface AsyncOutput extends Output {
-
-        boolean isOverheadLimitExceeded();
-
-        AbstractEndpoint.Handler.SocketState upgradeDispatch(SocketEvent 
status);
-
-        void closeConnection(Http2Exception ce);
-
-        void processConnectionCallback(WebConnection webConnection, Stream 
stream);
-
-    }
-
 }
diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index 9d930b209f..022035cb3d 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -94,7 +94,7 @@ public class Http2AsyncUpgradeHandler extends 
Http2UpgradeHandler {
 
     @Override
     protected Http2Parser getParser(String connectionId) {
-        return new Http2AsyncParser(connectionId, this, this, socketWrapper);
+        return new Http2AsyncParser(connectionId, this, this, socketWrapper, 
this);
     }
 
 


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

Reply via email to