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

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

commit dd4f5dcc87d1b6b8bc517c8df825bf0d5172035f
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/Http2AsyncParser.java |  2 +-
 java/org/apache/coyote/http2/Http2Parser.java      | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java 
b/java/org/apache/coyote/http2/Http2AsyncParser.java
index eefc4c7..89cdc82 100644
--- a/java/org/apache/coyote/http2/Http2AsyncParser.java
+++ b/java/org/apache/coyote/http2/Http2AsyncParser.java
@@ -260,7 +260,7 @@ class Http2AsyncParser extends Http2Parser {
                                 readSettingsFrame(flags, payloadSize, payload);
                                 break;
                             case PUSH_PROMISE:
-                                readPushPromiseFrame(streamId, payload);
+                                readPushPromiseFrame(streamId, flags, 
payloadSize, payload);
                                 break;
                             case PING:
                                 readPingFrame(flags, payload);
diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index 0d9a804..edc48ac 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -109,7 +109,7 @@ class Http2Parser {
             readSettingsFrame(flags, payloadSize, null);
             break;
         case PUSH_PROMISE:
-            readPushPromiseFrame(streamId, null);
+            readPushPromiseFrame(streamId, flags, payloadSize, null);
             break;
         case PING:
             readPingFrame(flags, null);
@@ -349,12 +349,16 @@ class Http2Parser {
      * re-used for client side parsing, this method should be overridden with 
an
      * appropriate implementation.
      *
-     * @param streamId The pushed stream
-     * @param buffer   The payload, if available
+     * @param streamId      The pushed stream
+     * @param flags         The flags set in the frame header
+     * @param payloadSize   The size of the payload in bytes
+     * @param buffer        The payload, if available
      *
      * @throws Http2Exception Always
+     * @throws IOException May be thrown by sub-classes that parse this frame
      */
-    protected void readPushPromiseFrame(int streamId, ByteBuffer buffer) 
throws Http2Exception {
+    protected void readPushPromiseFrame(int streamId, int flags, int 
payloadSize, ByteBuffer buffer)
+            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