delphi - Indy的TIdHTTPProxyServer : How to filter requests?

标签 delphi indy10

我正在使用 TIdHTTPProxyServer 来实现一个简单的 HTTP 代理,但我现在想阻止一些与某些 URL 匹配的连接。哪个事件和/或组件最适合实现这一目标? Indy 文档并没有太多解释。 :(

谢谢!

最佳答案

作为基本过滤器,您可以使用 OnHTTPBeforeCommand 事件处理程序(该处理程序在命令发送到 HTTP 服务器之前触发)。

检查 Context 参数属性,您会发现很有用:

Context.Command
Context.OutboundClient.Host
Context.OutboundClient.Port
Context.Document
Context.Headers

此时我从未尝试停止 PassTrough,但我敢打赌,如果您确定存在阻止规则匹配,则只需在此时引发异常即可做到这一点。

关于delphi - Indy的TIdHTTPProxyServer : How to filter requests?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4666773/

相关文章:

delphi - 在 Delphi XE 中使用通用容器 - 总是吗?

datetime - 通过 RTTI 将 TDateTime 值传递给 OleVariant 属性

Delphi、OmniXML - XML 绑定(bind)?

delphi - 通过电子邮件将 StringList 作为附件发送 - Indy

delphi - 对 smtp.live.com 和 TIdSmtp(Indy、Delphi)的 SSL 支持

delphi - 启动长时间运行的后台进程并检查状态

delphi - 'hex' 或 'escape' 中的 PostgreSQL 9.X bytea 表示形式用于缩略图

delphi - 从 idhttp get 获取字符串

用于 Delphi 的 Javascript 引擎

delphi - 具有数千个客户端的客户端-服务器的最佳组件