如何限制服务器接收到的websocket帧的净长度 [英] How to limit in netty length of websocket frame received by server

查看:71
本文介绍了如何限制服务器接收到的websocket帧的净长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用netty 3.4实现WebSocket服务.

I am implementing a WebSocket service using netty 3.4.

我需要限制帧大小,以避免非常长的帧发生DoS攻击.我希望在32KB数据之后删除连接,即使该帧尚未完成并且还没有传递给我的处理程序.

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.

有什么办法吗?

推荐答案

给出

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

您将必须扩展WebSocket08FrameDecoder并更改toFrameLength()中的代码.

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.

这篇关于如何限制服务器接收到的websocket帧的净长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆