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
The following commit(s) were added to refs/heads/9.0.x by this push:
new f69662e Ensure the overhead check runs after every frame
f69662e is described below
commit f69662e539fde0a94ab36933676ac58c07911672
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Sep 8 22:29:07 2020 +0100
Ensure the overhead check runs after every frame
---
.../apache/coyote/http2/Http2UpgradeHandler.java | 11 +++++----
test/org/apache/coyote/http2/TestHttp2Limits.java | 27 ++++++++++++++++++++++
webapps/docs/changelog.xml | 4 ++++
3 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index e63f174..a1434bf 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -340,11 +340,12 @@ class Http2UpgradeHandler extends AbstractStream
implements InternalHttpUpgradeH
} else {
stream.close(se);
}
- }
- if (overheadCount.get() > 0) {
- throw new ConnectionException(
-
sm.getString("upgradeHandler.tooMuchOverhead", connectionId),
- Http2Error.ENHANCE_YOUR_CALM);
+ } finally {
+ if (overheadCount.get() > 0) {
+ throw new ConnectionException(
+
sm.getString("upgradeHandler.tooMuchOverhead", connectionId),
+ Http2Error.ENHANCE_YOUR_CALM);
+ }
}
}
diff --git a/test/org/apache/coyote/http2/TestHttp2Limits.java
b/test/org/apache/coyote/http2/TestHttp2Limits.java
index 97345a4..2fa0686 100644
--- a/test/org/apache/coyote/http2/TestHttp2Limits.java
+++ b/test/org/apache/coyote/http2/TestHttp2Limits.java
@@ -38,6 +38,33 @@ public class TestHttp2Limits extends Http2TestBase {
private static final StringManager sm =
StringManager.getManager(TestHttp2Limits.class);
+
+ @Test
+ public void testSettingsOverheadLimits() throws Exception {
+ http2Connect(false);
+
+ for (int i = 0; i < 100; i++) {
+ sendSettings(0, false);
+ parser.readFrame(true);
+ String trace = output.getTrace();
+ if (trace.equals("0-Settings-Ack\n")) {
+ // Test continues
+ output.clearTrace();
+ } else if (trace.startsWith("0-Goaway-[1]-[11]-[Connection [")) {
+ // Test passed
+ return;
+ } else {
+ // Test failed
+ Assert.fail("Unexpected output: " + output.getTrace());
+ }
+ Thread.sleep(100);
+ }
+
+ // Test failed
+ Assert.fail("Connection not closed down");
+ }
+
+
@Test
public void testHeaderLimits1x128() throws Exception {
// Well within limits
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9c123f5..ecce19f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -183,6 +183,10 @@
closed HTTP/2 streams as they triggered multiple regressions in the
form
of <code>NullPointerException</code>s. (markt)
</fix>
+ <fix>
+ Ensure that the HTTP/2 overhead protection check is performed after
+ each HTTP/2 frame is processed. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]