【问题标题】:How do I forward request to another proxy server using TIdHTTPProxyServer (proxy chain)如何使用 TIdHTTPProxyServer(代理链)将请求转发到另一个代理服务器
【发布时间】:2012-07-23 03:46:49
【问题描述】:

目前我想让我的 indy 代理服务器将请求转发到另一个代理服务器。我找到了this link 并自己尝试了一下。但是我的代码在没有任何错误消息的情况下无法运行,就好像我没有进行任何更改一样。我的代码在 C++ XE2 中如下所示。

void __fastcall TForm3::MyProxyHTTPBeforeCommand(TIdHTTPProxyServerContext *AContext)
{
    TIdIOHandlerStack* tempIO = new TIdIOHandlerStack(NULL);

    TIdConnectThroughHttpProxy* tempProxy = new TIdConnectThroughHttpProxy(NULL);
    tempProxy->Enabled = true;
    tempProxy->Host = "localhost";
    tempProxy->Port = 8181 ;
    tempIO->TransparentProxy  =  tempProxy;
    AContext->OutboundClient->IOHandler =  tempIO;

}

【问题讨论】:

    标签: delphi proxy c++builder indy


    【解决方案1】:

    最后我发现我做了一些愚蠢的事情。正确的代码应该如下...

    void __fastcall TForm3::MyProxyHTTPBeforeCommand(TIdHTTPProxyServerContext *AContext)
    {
        TIdIOHandlerStack* tempIO = new TIdIOHandlerStack(AContext->OutboundClient);
    
        TIdConnectThroughHttpProxy* tempProxy = new TIdConnectThroughHttpProxy(AContext->OutboundClient);
        tempProxy->Enabled = true;
        tempProxy->Host = "localhost";
        tempProxy->Port = 8181 ;
        tempIO->TransparentProxy  =  tempProxy;
        AContext->OutboundClient->IOHandler =  tempIO;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-20
      • 2012-08-03
      • 2016-09-07
      • 1970-01-01
      • 2020-04-06
      • 1970-01-01
      • 2018-11-16
      • 1970-01-01
      相关资源
      最近更新 更多