Fix IndexOutOfBoundsException in HelloWorldHttp2Handler
Motivation: We need to duplicate the buffer before passing it to writeBytes(...) as it will increase the readerIndex(). Modifications: Call duplicate(). Result: No more IndexOutOfBoundsException when runing the multiplex example.
This commit is contained in:
parent
e94db103c9
commit
4a5340eae7
@ -76,7 +76,7 @@ public class HelloWorldHttp2Handler extends ChannelDuplexHandler {
|
||||
throws Exception {
|
||||
if (headers.isEndStream()) {
|
||||
ByteBuf content = ctx.alloc().buffer();
|
||||
content.writeBytes(RESPONSE_BYTES);
|
||||
content.writeBytes(RESPONSE_BYTES.duplicate());
|
||||
ByteBufUtil.writeAscii(content, " - via HTTP/2");
|
||||
sendResponse(ctx, content);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user