Indy HTTP代理服务器,如何设置密码?

发布于 2025-01-30 20:08:02 字数 127 浏览 2 评论 0原文

我正在考虑编写代理服务器。当我使用tidhttpproxyserver组件指定和激活端口时,代理服务器正常工作。到目前为止还可以,但是我无法密码,也无法打开IPV6代理。这只是IPv4代理。我找不到太多的文档。

I'm thinking of writing a Proxy Server. When I specify and activate the port using the TIdHTTPProxyServer component, the proxy server works properly. It's okay so far, but I can't password it and I can't open an IPv6 proxy. It's just an IPv4 proxy. I couldn't find much documentation on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚风撩人 2025-02-06 20:08:02

我无法密码

tidhttpproxyserver当前没有自己的任何身份验证。

客户端和目标服务器之间的HTTP身份验证在其中两个之间透明地处理,tidhttpproxyserver不参与该过程。

如果要密码保护代理本身,则必须在代理的onhttpbeforecommand事件中手动处理身份验证。检查客户端的请求标头(在事件的acontext.headers属性中)中的proxy-oterorization标题,如果不存在或其凭据失败,则可以手动发送客户端(通过acontext.connection属性)http 407响应包含适当的proxy-authenticate header,然后rise repand/code>异常(或断开acontext.connection)以停止处理当前代理请求。

我无法打开IPv6代理。这只是IPv4代理。

tidhttpproxyserver可以同时处理IPv4和ipv6,但需要进行一些手动设置。

默认情况下,默认情况下,在global id_default_ip_ip_version Indy的iDglobal unit中指定了默认情况下的任何IP版本Indy(除非设置为IPv4) 在IDCOMPILERDEFINES.inc中定义的)。

可以在代理的bindings集合中配置IP/端口对。您可以为每个绑定指定iPversioniPversion设置为iD_DEFAULT_IP_VERSION默认情况下。

如果未指定任何bindings条目,则代替代理的defaultport属性。然后,代理将根据平台和操作系统功能打开1或2个侦听端口。如果打开1个端口,它将使用id_default_ip_version。如果打开了2个端口,则1个为IPv4,1为IPv6。

因此,如果您想控制侦听IP/端口的设置,请不要将bindings空。

客户端连接到侦听端口后,tidhttpproxyservercontext.outboundclient用于连接到下一个HTTP服务器的对象将使用ID_DEFAULT_IP_VERSION默认情况下。您可以通过将事件的acontext.OutBoundClient属性施放到tidtcpclient,然后设置其ipversion ipversion ipversion ipversion ipversion ipversion ipversion /代码>属性。

I can't password it

TIdHTTPProxyServer does not currently implement any authentication of its own.

HTTP authentication between the client and target server is handled transparently between the two of them, TIdHTTPProxyServer is not involved in that process.

If you want to password-protect the proxy itself, you will have to manually handle authentication in the proxy's OnHTTPBeforeCommand event. Check the client's request headers (in the event's AContext.Headers property) for a Proxy-Authorization header, and if it is not present, or its credentials fail, then manually send the client (via the AContext.Connection property) an HTTP 407 response containing an appropriate Proxy-Authenticate header, and then raise an exception (or disconnect the AContext.Connection) to stop processing the current proxy request.

I can't open an IPv6 proxy. It's just an IPv4 proxy.

TIdHTTPProxyServer can handle both IPv4 and IPv6, but it will require some manual setup.

Whichever IP version Indy is compiled for by default is specified in the global ID_DEFAULT_IP_VERSION constant in Indy's IdGlobal unit (it is set to IPv4, unless Indy is compiled with IdIPv6 defined in IdCompilerDefines.inc).

Listening IP/port pairs can be configured in the proxy's Bindings collection. You can specify an IPVersion for each binding. The IPVersion is set to ID_DEFAULT_IP_VERSION by default.

If you don't specify any Bindings entries, the proxy's DefaultPort property is used instead. The proxy will then open either 1 or 2 listening ports, depending on platform and OS capabilities. If 1 port is opened, it will use ID_DEFAULT_IP_VERSION. If 2 ports are opened, 1 will be IPv4 and 1 will be IPv6.

So, if you want control over the setup of the listening IP/ports, don't leave the Bindings empty.

Once a client has connected to a listening port, the TIdHTTPProxyServerContext.OutboundClient object that is used to connect to the next HTTP server will use ID_DEFAULT_IP_VERSION by default. You can override this in the proxy's OnHTTPBeforeCommand event, by casting the event's AContext.OutboundClient property to TIdTCPClient and then setting its IPVersion property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文