Skip to content

Correctly handle http2 upgrades when Http2FrameCodec is used together…#9318

Merged
normanmaurer merged 2 commits into
4.1from
http2_upgrade_multiplex_handler
Jul 4, 2019
Merged

Correctly handle http2 upgrades when Http2FrameCodec is used together…#9318
normanmaurer merged 2 commits into
4.1from
http2_upgrade_multiplex_handler

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

… with Http2MultiplexHandler

Motivation:

In the latest release we introduced Http2MultiplexHandler as a replacement of Http2MultiplexCodec. This did split the frame parsing from the multiplexing to allow a more flexible way to handle frames and to make the code cleaner. Unfortunally we did miss to special handle this in Http2ServerUpgradeCodec and so did not correctly add Http2MultiplexHandler to the pipeline before calling Http2FrameCodec.onHttpServerUpgrade(...). This did lead to the situation that we did not correctly receive the event on the Http2MultiplexHandler and so did not correctly created the Http2StreamChannel for the upgrade stream. Because of this we ended up with an NPE if a frame was dispatched to the upgrade stream later on.

Modifications:

  • Correctly add Http2MultiplexHandler to the pipeline before calling Http2FrameCodec.onHttpServerUpgrade(...)
  • Add unit test

Result:

Fixes #9314.

… with Http2MultiplexHandler

Motivation:

In the latest release we introduced Http2MultiplexHandler as a replacement of Http2MultiplexCodec. This did split the frame parsing from the multiplexing to allow a more flexible way to handle frames and to make the code cleaner. Unfortunally we did miss to special handle this in Http2ServerUpgradeCodec and so did not correctly add Http2MultiplexHandler to the pipeline before calling Http2FrameCodec.onHttpServerUpgrade(...). This did lead to the situation that we did not correctly receive the event on the Http2MultiplexHandler and so did not correctly created the Http2StreamChannel for the upgrade stream. Because of this we ended up with an NPE if a frame was dispatched to the upgrade stream later on.

Modifications:

- Correctly add Http2MultiplexHandler to the pipeline before calling Http2FrameCodec.onHttpServerUpgrade(...)
- Add unit test

Result:

Fixes #9314.
@normanmaurer normanmaurer force-pushed the http2_upgrade_multiplex_handler branch from 6ef6e53 to 9494395 Compare July 3, 2019 12:19
@normanmaurer
Copy link
Copy Markdown
Member Author

@netty-bot test this please

ctx.pipeline().addAfter(ctx.name(), handlerName, connectionHandler);

// As we will re-act on the created streams in the Http2MultiplexHandler we need to ensure we special
// handle it and put it into the pipeline before we all onHttp2ServerUpgrade(...) is called. Otherwise
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/we call//

@normanmaurer normanmaurer requested a review from ejona86 July 3, 2019 18:54
@normanmaurer normanmaurer force-pushed the http2_upgrade_multiplex_handler branch from 7b95c89 to 35e3ff6 Compare July 3, 2019 18:55
@normanmaurer normanmaurer merged commit 16b98d3 into 4.1 Jul 4, 2019
@normanmaurer normanmaurer deleted the http2_upgrade_multiplex_handler branch July 4, 2019 06:32
normanmaurer added a commit that referenced this pull request Jul 4, 2019
#9318)


Motivation:

In the latest release we introduced Http2MultiplexHandler as a replacement of Http2MultiplexCodec. This did split the frame parsing from the multiplexing to allow a more flexible way to handle frames and to make the code cleaner. Unfortunally we did miss to special handle this in Http2ServerUpgradeCodec and so did not correctly add Http2MultiplexHandler to the pipeline before calling Http2FrameCodec.onHttpServerUpgrade(...). This did lead to the situation that we did not correctly receive the event on the Http2MultiplexHandler and so did not correctly created the Http2StreamChannel for the upgrade stream. Because of this we ended up with an NPE if a frame was dispatched to the upgrade stream later on.

Modifications:

- Correctly add Http2MultiplexHandler to the pipeline before calling Http2FrameCodec.onHttpServerUpgrade(...)
- Add unit test

Result:

Fixes #9314.
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.

NullPointerException at line 179 in Http2MultiplexHandler.java

2 participants