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

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

commit f5459e6bd0f8d991193d85589ef9c2b72992772a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 14 19:22:41 2022 +0000

    Refactor the handling of push promise frames for benefit of sub-classes
    
    To correctly handle a push-promise frame, sub-classes need access to the
    flags and payload size from the frame header.
---
 java/org/apache/coyote/http2/Http2Parser.java | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index f4298d7..8fc7385 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -107,7 +107,7 @@ class Http2Parser {
             readSettingsFrame(flags, payloadSize);
             break;
         case PUSH_PROMISE:
-            readPushPromiseFrame(streamId);
+            readPushPromiseFrame(streamId, flags, payloadSize);
             break;
         case PING:
             readPingFrame(flags);
@@ -316,7 +316,20 @@ class Http2Parser {
     }
 
 
-    private void readPushPromiseFrame(int streamId) throws Http2Exception {
+    /**
+     * This default server side implementation always throws an exception. If
+     * re-used for client side parsing, this method should be overridden with 
an
+     * appropriate implementation.
+     *
+     * @param streamId      The pushed stream
+     * @param flags         The flags set in the frame header
+     * @param payloadSize   The size of the payload in bytes
+     *
+     * @throws Http2Exception Always
+     * @throws IOException May be thrown by sub-classes that parse this frame
+     */
+    protected void readPushPromiseFrame(int streamId, int flags, int 
payloadSize)
+            throws Http2Exception, IOException {
         throw new 
ConnectionException(sm.getString("http2Parser.processFramePushPromise",
                 connectionId, Integer.valueOf(streamId)), 
Http2Error.PROTOCOL_ERROR);
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to