How to limit in netty length of websocket frame re

2019-08-01 15:44发布

问题:

I am implementing a WebSocket service using netty 3.4.

I need to limit the frame size to avoid DoS attacks with very very long frames. I want the connection to be dropped after 32KB of data, even if the frame was not finished yet and it was not passed to my Handler.

Is there any way to do that?

回答1:

Given the code as it stands at the moment, doesn't look like it at the moment.

You will have to extend WebSocket08FrameDecoder and change the code in toFrameLength().

If I get a chance, I'll put in a pull request for the next release.