Skip to content

Spdy: Add UnknownFrame parsing support for SpdyFrameCodec.#14561

Merged
normanmaurer merged 8 commits into
4.1from
spdy
Dec 13, 2024
Merged

Spdy: Add UnknownFrame parsing support for SpdyFrameCodec.#14561
normanmaurer merged 8 commits into
4.1from
spdy

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:
To make our codec more flexible we should add support for unknown frames in SPDY.

Modifications:

  • Add SpdyFrameDecoderExtendedDelegate that supports unknown frames
  • Add new constructor and protected method to SpdyFrameCodec that makes it easy to support it

Result:

More flexible SPDY implementation.

Motivation:
To make our codec more flexible we should add support for unknown frames in SPDY.

Modifications:

- Add SpdyFrameDecoderExtendedDelegate that supports unknown frames
- Add new constructor and protected method to SpdyFrameCodec that makes it easy to support it

Result:

More flexible SPDY implementation.

Co-authored-by: Norman Maurer <norman_maurer@apple.com>
@normanmaurer
Copy link
Copy Markdown
Member Author

/cc @He-Pin PTAL

@normanmaurer normanmaurer added this to the 4.2.0.Final milestone Dec 12, 2024
Comment thread codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyFrameCodec.java Outdated
Comment thread codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyFrameCodec.java Outdated
@normanmaurer
Copy link
Copy Markdown
Member Author

@He-Pin I think this is ready to go... PTAL

public void readUnknownFrame(int frameType, byte flags, ByteBuf payload) {
read = true;
SpdyUnknownFrame spdyUnknownFrame = new DefaultSpdyUnknownFrame(frameType, flags, payload);
ctx.fireChannelRead(spdyUnknownFrame);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about adding a protected method: createSpdyUnknownFrame, then I can override it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I can do this if you need it.

@normanmaurer
Copy link
Copy Markdown
Member Author

@He-Pin PTAL again

}

protected SpdyUnknownFrame newSpdyUnknownFrame(int frameType, byte flags, ByteBuf payload) {
return new DefaultSpdyUnknownFrame(frameType, flags, payload);
Copy link
Copy Markdown
Contributor

@He-Pin He-Pin Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but I think this can better be a SpdyFrame , which only is a maker interface, otherwise users will have to implement the ByteBufHolder, and In our implementation, CustFrame extends SpdyFrame.

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Dec 12, 2024

LGTM

@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Dec 13, 2024

The milestone should be 4.1.116.Final now.

return false;
}
if (delegate instanceof SpdyFrameDecoderExtendedDelegate) {
ByteBuf data = buffer.alloc().buffer(length);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about using buffer.readSlice here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we could use readRetainedSlice(...). But let's do this in a followup as its true for other methods as well.

@normanmaurer normanmaurer merged commit dd97c68 into 4.1 Dec 13, 2024
@normanmaurer normanmaurer deleted the spdy branch December 13, 2024 09:03
@He-Pin
Copy link
Copy Markdown
Contributor

He-Pin commented Dec 13, 2024

Thanks

normanmaurer added a commit that referenced this pull request Dec 13, 2024
Motivation:
To make our codec more flexible we should add support for unknown frames
in SPDY.

Modifications:

- Add default method to SpdyFrameDecoderDelegate to support unknown frames
- Add new constructor and protected method to SpdyFrameCodec that makes
it easy to support it

Result:

More flexible SPDY implementation.

---------

Co-authored-by: 虎鸣 <hepin.p@alibaba-inc.com>
normanmaurer added a commit that referenced this pull request Dec 13, 2024
…14569)

Motivation:
To make our codec more flexible we should add support for unknown frames
in SPDY.

Modifications:

- Add default method to SpdyFrameDecoderDelegate to support unknown
frames
- Add new constructor and protected method to SpdyFrameCodec that makes
it easy to support it

Result:

More flexible SPDY implementation.

Co-authored-by: 虎鸣 <hepin.p@alibaba-inc.com>
@normanmaurer normanmaurer modified the milestones: 4.2.0.Final, 4.2.0.RC2 Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants