Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: idfTP and Socks problem

www.cryer.info
Managed Newsgroup Archive

Re: idfTP and Socks problem

Subject:Re: idfTP and Socks problem
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 12 Dec 2007 15:01:02

"UlfH" <Ulf_Honkanen@nospam.umu.se> wrote in message
news:47604ad3@newsgroups.borland.com...

> Yes, but this leaves the TrasparentProxy.Enable = false

It shouldn't.  TIdSocksInfo overrides GetEnabled() to return True when its
Version property is not set to svNoSocks:

    function TIdSocksInfo.GetEnabled: Boolean;
    Begin
        Result := Version in [svSocks4, svSocks4A, svSocks5];
    End;//

When SetTransparentProxy() is passed a proxy with no Owner, it makes a new
instance of the proxy class type (a new TIdSocksInfo instance in this case),
and then TIdSocksInfo.AssignTo() copies the Version value (thus copying the
Enabled value) to the new instance:

    procedure TIdIOHandlerSocket.SetTransparentProxy(AProxy :
TIdCustomTransparentProxy);
    var
        LClass: TIdCustomTransparentProxyClass;
    begin
        //...
        if Assigned(AProxy) then begin
            if not Assigned(AProxy.Owner) then begin
                //...
                LClass := TIdCustomTransparentProxyClass(AProxy.ClassType);
                //..
                if not Assigned(FTransparentProxy) then begin
                    FTransparentProxy := LClass.Create(nil); // <-- new
TIdSocksInfo instance created
                end;
                FTransparentProxy.Assign(AProxy); // <-- source TIdSocksInfo
copied to new instance
            end else begin
                //...
            end;
        end
        //...
    end;

    procedure TIdSocksInfo.AssignTo(ASource: TPersistent);
    begin
        if ASource is TIdSocksInfo then begin
            with TIdSocksInfo(ASource) do begin
                //...
                Version := Self.Version; // <-- "Enabled" property
indirectly copied
            end;
        end
        //...
    end;


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive