This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new c65af31ac4 Add HTTP/2 from CoPilot review of 0de12dcc
c65af31ac4 is described below
commit c65af31ac41c0a4ea62f02727548d49cf3a7d605
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Mar 19 15:23:19 2026 +0000
Add HTTP/2 from CoPilot review of 0de12dcc
Add test for HTTP/2 HEADERS frame with both PADDED and PRIORITY flags too
much padding
Co-authored-by: copilot-swe-agent[bot]
<[email protected]>
---
.../apache/coyote/http2/TestHttp2Section_6_2.java | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
b/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
index 9e903ceed9..107919c0e1 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
@@ -91,6 +91,42 @@ public class TestHttp2Section_6_2 extends Http2TestBase {
}
+ @Test
+ public void testHeaderFrameTooMuchPaddingWithPriority() throws Exception {
+ // Tests the case where both PADDED and PRIORITY flags are set and the
+ // padding length is too large relative to the payload after accounting
+ // for the optional bytes (1 byte pad length + 5 bytes priority = 6
bytes).
+ // With payloadSize=8 and padLength=3, the actual available payload
+ // after optional bytes is only 2, so padLength >= available triggers
+ // a PROTOCOL_ERROR and a GOAWAY frame must be sent.
+ http2Connect();
+
+ // 9 bytes frame header + 8 bytes payload
+ byte[] headerFrame = new byte[17];
+
+ // Header
+ // length = 8
+ ByteUtil.setThreeBytes(headerFrame, 0, 8);
+ headerFrame[3] = FrameType.HEADERS.getIdByte();
+ // flags: PADDED (0x08) | PRIORITY (0x20)
+ headerFrame[4] = 0x28;
+ // stream 3
+ ByteUtil.set31Bits(headerFrame, 5, 3);
+ // payload:
+ // pad length = 3 (too large: only 2 bytes remain after 6 optional
bytes)
+ headerFrame[9] = 3;
+ // priority: 5 bytes (bytes 10-14, all zero)
+ // remaining 2 bytes: bytes 15-16 (all zero)
+
+ os.write(headerFrame);
+ os.flush();
+
+ // 1 is the last stream processed before the connection error (stream 1
+ // from the initial HTTP/1.1 upgrade)
+ handleGoAwayResponse(1);
+ }
+
+
@Test
public void testHeaderFrameWithZeroLengthPadding() throws Exception {
http2Connect();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]