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

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

commit ae5e5a96d51f3e826f5401300e99d5d378038e12
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Aug 18 21:12:46 2020 +0100

    Expand to ensure clean closure with connection flow control error
---
 .../apache/coyote/http2/TestHttp2Section_5_1.java  | 63 +++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 00c0495..6ec315a 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -334,7 +334,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
 
 
     @Test
-    public void testErrorOnWaitingStream() throws Exception {
+    public void testErrorOnWaitingStream01() throws Exception {
         // http2Connect() - modified
         enableHttp2(1);
         configureAndStartWebApplication();
@@ -387,4 +387,65 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         parser.readFrame(true);
         Assert.assertEquals("3-RST-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]\n", output.getTrace());
     }
+
+
+    @Test
+    public void testErrorOnWaitingStream02() throws Exception {
+        // http2Connect() - modified
+        enableHttp2(1);
+        configureAndStartWebApplication();
+        openClientConnection();
+        doHttpUpgrade();
+        sendClientPreface();
+
+        // validateHttp2InitialResponse() - modified
+        parser.readFrame(true);
+        parser.readFrame(true);
+        parser.readFrame(true);
+        parser.readFrame(true);
+        parser.readFrame(true);
+
+        Assert.assertEquals("0-Settings-[3]-[1]\n" +
+                "0-Settings-End\n" +
+                "0-Settings-Ack\n" +
+                "0-Ping-[0,0,0,0,0,0,0,1]\n" +
+                getSimpleResponseTrace(1)
+                , output.getTrace());
+        output.clearTrace();
+
+        sendLargeGetRequest(3);
+
+        sendSimpleGetRequest(5);
+
+        // Default connection window size is 64k-1.
+        // Initial request will have used 8k leaving 56k-1.
+        // Stream window will be 64k-1.
+
+        // Increase Connection window by 16k
+        sendWindowUpdate(0, 16 * 1024);
+
+        // Expecting
+        // 1 * headers
+        // 64k-1 of body (8 * ~8k)
+        // 1 * error (could be in any order)
+        for (int i = 0; i < 9; i++) {
+            parser.readFrame(true);
+        }
+        parser.readFrame(true);
+
+        Assert.assertTrue(output.getTrace(),
+                output.getTrace().contains("5-RST-[" + 
Http2Error.REFUSED_STREAM.getCode() + "]"));
+        output.clearTrace();
+
+        // Connection window is 8k.
+        // Stream window is zero.
+
+        // Expand the connection window too much to trigger an error
+        // Allow for the 8k still in the connection window
+        sendWindowUpdate(0, (1 << 31) - 1);
+
+        parser.readFrame(true);
+        Assert.assertTrue(output.getTrace(),
+                output.getTrace().contains("0-Goaway-[5]-[" + 
Http2Error.FLOW_CONTROL_ERROR.getCode() + "]"));
+    }
 }


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

Reply via email to