如何在TIdHTTPServer上将IP列入黑名单 [英] How to blacklist an IP on TIdHTTPServer

查看:168
本文介绍了如何在TIdHTTPServer上将IP列入黑名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TIdHTTPServer 组件中,我想启用IP地址黑名单进行阻止。我想确保此级别处于最低级别,以防止来自黑名单客户端的任何不必要的数据流流入。我应该如何拦截此服务器组件以在最低级别上阻止IP?这适用于IP v4和v6

解决方案

在Indy 9上,有一个事件在实际被接受之前拒绝连接。在Indy 10上,它仍未实现。



如果您查看IdCustomTCPServer.pas,则在过程TIdListenerThread.Run 中那里有一条评论,它向用户公开了一个事件,让他们决定是否应该接受连接。



我将修改源代码并在其中实现。 / p>

如果这不适合您,则可以在OnConnect事件中断开它们的连接。


In a TIdHTTPServer component, I'd like to enable a blacklist of IP addresses to block. I'd like to make sure this is on the lowest level possible to prevent any unnecessary data streaming in from a blacklisted client. How should I intercept this server component to block an IP on the lowest level possible? This applies to both IP v4 and v6

解决方案

On Indy 9, there was an event for refusing a connection before it was actually accepted. On Indy 10, it's still not implemented.

If you look at IdCustomTCPServer.pas, in procedure TIdListenerThread.Run there is a comment in there about exposing an event to the user to let them decide whether the connection should be accepted.

I would modify the source and implement it there.

If that's not for you, then you can disconnect them in the OnConnect event.

这篇关于如何在TIdHTTPServer上将IP列入黑名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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