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
The following commit(s) were added to refs/heads/8.5.x by this push:
new c656fbb Fix HTTP/2 window updates with zero padding. Found via CI
tests
c656fbb is described below
commit c656fbbc8817cf3dd7c09a90a27d39714dd718de
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Oct 8 14:20:53 2020 +0100
Fix HTTP/2 window updates with zero padding. Found via CI tests
---
java/org/apache/coyote/http2/Http2UpgradeHandler.java | 11 +++++------
webapps/docs/changelog.xml | 9 +++++++++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index d5d11e5..458b112 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -797,7 +797,7 @@ public class Http2UpgradeHandler extends AbstractStream
implements InternalHttpU
* Needs to know if this was application initiated since that affects the
* error handling.
*/
- void writeWindowUpdate(Stream stream, int increment, boolean
applicationInitiated)
+ void writeWindowUpdate(AbstractNonZeroStream stream, int increment,
boolean applicationInitiated)
throws IOException {
synchronized (socketWrapper) {
// Build window update frame for stream 0
@@ -806,7 +806,8 @@ public class Http2UpgradeHandler extends AbstractStream
implements InternalHttpU
frame[3] = FrameType.WINDOW_UPDATE.getIdByte();
ByteUtil.set31Bits(frame, 9, increment);
socketWrapper.write(true, frame, 0, frame.length);
- if (stream.canWrite()) {
+ // No need to send update from closed stream
+ if (stream instanceof Stream && ((Stream) stream).canWrite()) {
// Change stream Id and re-use
ByteUtil.set31Bits(frame, 5, stream.getIdAsInt());
try {
@@ -1595,10 +1596,8 @@ public class Http2UpgradeHandler extends AbstractStream
implements InternalHttpU
public void swallowedPadding(int streamId, int paddingLength) throws
ConnectionException, IOException {
AbstractNonZeroStream abstractNonZeroStream =
getStreamMayBeClosed(streamId, true);
- if (abstractNonZeroStream instanceof Stream) {
- // +1 is for the payload byte used to define the padding length
- writeWindowUpdate((Stream) abstractNonZeroStream, paddingLength +
1, false);
- }
+ // +1 is for the payload byte used to define the padding length
+ writeWindowUpdate(abstractNonZeroStream, paddingLength + 1, false);
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 49ef2e2..3012e9a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -59,6 +59,15 @@
</update>
</changelog>
</subsection>
+ <subseciton name="Coyote">
+ <changelog>
+ <fix>
+ Refactor the HTTP/2 window update handling for padding in data frames
to
+ ensure that the connection window is correctly updated after a data
+ frame with zero lngth padding is received. (markt)
+ </fix>
+ </changelog>
+ </subseciton>
</section>
<section name="Tomcat 8.5.59 (markt)" rtext="release in progress">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]