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

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


The following commit(s) were added to refs/heads/main by this push:
     new 60ce4c75e5 Revert "Refactor for consistency"
60ce4c75e5 is described below

commit 60ce4c75e55ab17b990df69815c7c1485a7b6168
Author: remm <[email protected]>
AuthorDate: Tue May 19 22:53:26 2026 +0200

    Revert "Refactor for consistency"
    
    This reverts commit d3c87f2e9b65c0caf5c5bcfe7426eecb92838177.
---
 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 31a6c7735e..5274374d0d 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);
         }
     }
 
@@ -280,7 +281,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();
@@ -318,7 +319,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);
             }
         }
 
@@ -330,25 +331,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 77c3e4cf35..83b9adb6d7 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