tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [tomcat] 01/06: Rename Output.swallowedPadding to onSwallowedDataFramePayload
Date Mon, 15 Mar 2021 19:26:41 GMT
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 659d29df58be5c87793a0435f5b84e8fa8820140
Author: Mark Thomas <markt@apache.org>
AuthorDate: Fri Mar 12 09:55:38 2021 +0000

    Rename Output.swallowedPadding to onSwallowedDataFramePayload
    
    This change is in preparation for fixes to BZ 65179
---
 java/org/apache/coyote/http2/Http2Parser.java         | 17 +++++++++++++++--
 java/org/apache/coyote/http2/Http2UpgradeHandler.java |  4 ++--
 test/org/apache/coyote/http2/Http2TestBase.java       |  6 +++---
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2Parser.java b/java/org/apache/coyote/http2/Http2Parser.java
index 4725a1f..7299ba6 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -208,7 +208,7 @@ class Http2Parser {
             }
         }
         if (Flags.hasPadding(flags)) {
-            output.swallowedPadding(streamId, padLength);
+            output.onSwallowedDataFramePayload(streamId, padLength);
         }
     }
 
@@ -731,7 +731,20 @@ class Http2Parser {
         ByteBuffer startRequestBodyFrame(int streamId, int payloadSize, boolean endOfStream)
throws Http2Exception;
         void endRequestBodyFrame(int streamId) throws Http2Exception;
         void receivedEndOfStream(int streamId) throws ConnectionException;
-        void swallowedPadding(int streamId, int paddingLength) throws ConnectionException,
IOException;
+        /**
+         * Notification triggered when the parser swallows some or all of a DATA
+         * frame payload without writing it to the ByteBuffer returned by
+         * {@link #startRequestBodyFrame(int, int, boolean)}.
+         *
+         * @param streamId  The stream on which the payload that has been
+         *                  swallowed was received
+         * @param swallowedDataBytesCount   The number of bytes that the parser
+         *                                  swallowed.
+         *
+         * @throws ConnectionException
+         * @throws IOException
+         */
+        void onSwallowedDataFramePayload(int streamId, int swallowedDataBytesCount) throws
ConnectionException, IOException;
 
         // Header frames
         HeaderEmitter headersStart(int streamId, boolean headersEndStream)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 6c59771..ea43873 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1503,11 +1503,11 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH
 
 
     @Override
-    public void swallowedPadding(int streamId, int paddingLength) throws
+    public void onSwallowedDataFramePayload(int streamId, int swallowedDataBytesCount) throws
             ConnectionException, IOException {
         AbstractNonZeroStream abstractNonZeroStream = getAbstractNonZeroStream(streamId,
true);
         // +1 is for the payload byte used to define the padding length
-        writeWindowUpdate(abstractNonZeroStream, paddingLength + 1, false);
+        writeWindowUpdate(abstractNonZeroStream, swallowedDataBytesCount + 1, false);
     }
 
 
diff --git a/test/org/apache/coyote/http2/Http2TestBase.java b/test/org/apache/coyote/http2/Http2TestBase.java
index 7e04cfc..eb9f83b 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -1182,10 +1182,10 @@ public abstract class Http2TestBase extends TomcatBaseTest {
 
 
         @Override
-        public void swallowedPadding(int streamId, int paddingLength) {
+        public void onSwallowedDataFramePayload(int streamId, int swallowedDataBytesCount)
{
             trace.append(streamId);
-            trace.append("-SwallowedPadding-[");
-            trace.append(paddingLength);
+            trace.append("-SwallowedDataFramePayload-[");
+            trace.append(swallowedDataBytesCount);
             trace.append("]\n");
         }
 


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


Mime
View raw message