GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix HTTP 2 PUSH_PROMISE stream association validation (#16952) · netty/netty@6dabf56

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • codec-http2/src
    • main/java/io/netty/handler/codec/http2
      • DefaultHttp2FrameReader.java
    • test/java/io/netty/handler/codec/http2
      • DefaultHttp2FrameReaderTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java‎

Copy file name to clipboardExpand all lines: codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ private void verifySettingsFrame() throws Http2Exception {
343343
}
344344

345345
private void verifyPushPromiseFrame() throws Http2Exception {
346+
verifyAssociatedWithAStream();
346347
verifyNotProcessingHeaders();
347348

348349
// Subtract the length of the promised stream ID field, to determine the length of the
Collapse file

‎codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2FrameReaderTest.java‎

Copy file name to clipboardExpand all lines: codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2FrameReaderTest.java
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,27 @@ public void execute() throws Throwable {
340340
}
341341
}
342342

343+
@Test
344+
public void failedWhenPushPromiseFrameNotAssociateWithStream() throws Http2Exception {
345+
final ByteBuf input = Unpooled.buffer();
346+
try {
347+
writeFrameHeader(input, INT_FIELD_LENGTH, PUSH_PROMISE, new Http2Flags().endOfHeaders(true), 0);
348+
input.writeInt(2);
349+
Http2Exception ex = assertThrows(Http2Exception.class, new Executable() {
350+
@Override
351+
public void execute() throws Throwable {
352+
frameReader.readFrame(ctx, input, listener);
353+
}
354+
});
355+
assertFalse(ex instanceof Http2Exception.StreamException);
356+
assertEquals(Http2Error.PROTOCOL_ERROR, ex.error());
357+
verify(listener, never()).onPushPromiseRead(any(ChannelHandlerContext.class), anyInt(), anyInt(),
358+
any(Http2Headers.class), anyInt());
359+
} finally {
360+
input.release();
361+
}
362+
}
363+
343364
@Test
344365
public void readPriorityFrame() throws Http2Exception {
345366
ByteBuf input = Unpooled.buffer();

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.