My fix:
if (LowerCase(FProtoStr) <> 'tcp') and (trim(FProtoStr)<>'6') then begin

Adopted.

And small optimization of TCustomSocksWSocket.SocksDoAuthenticate:

Rejected: not compatible with all Delphi versions.

--
[EMAIL PROTECTED]
http://www.overbyte.be


----- Original Message ----- From: "Piotr Hellrayzer Dałek" <[EMAIL PROTECTED]>
To: "TWSocket" <twsocket@elists.org>
Sent: Friday, June 17, 2005 9:38 PM
Subject: [twsocket] Protocol 6 (=TCP) not supported by TCustomSocksWSocket


Hi!

In TCustomSocksWSocket.Connect:

procedure TCustomSocksWSocket.Connect;
begin
[..]
   if LowerCase(FProtoStr) <> 'tcp' then begin
RaiseException('tcp is the only protocol supported thru socks server');
       Exit;
   end;
[..]

Let's say that someone has entered 6 in place of TCP in the Proto property
(obviously this is useless, as TWSocket do not rely on "Protocol" file,
so TCP is always properly converted into 6, but let's assume that TWSocket
user did this anyway) - TWSocket won't allow him to connect because it
expects TCP, not TCP _or_ 6.

My fix:


if (LowerCase(FProtoStr) <> 'tcp') and (trim(FProtoStr)<>'6') then begin
RaiseException('tcp is the only protocol supported thru socks server');
       Exit;
   end;


And small optimization of TCustomSocksWSocket.SocksDoAuthenticate:

procedure TCustomSocksWSocket.SocksDoAuthenticate;
var
   Buf     : array [0..127] of char;
   I, J    : Integer;
begin
   FSocksState := socksAuthenticate;
   TriggerSocksAuthState(socksAuthStart);
   Buf[0] := #$01; {06/03/99}           { Socks version }
   I      := 1;
   J      := Length(FSocksUsercode);
   Buf[I] := chr(j);
   Move(Pointer(FSocksUsercode)^, Buf[I + 1], J);
   I := I + 1 + J;
   J      := Length(FSocksPassword);
   Buf[I] := chr(j);
   Move(Pointer(FSocksPassword)^, Buf[I + 1], J);
   I := I + 1 + J;
   try
{TriggerDisplay('Send = ''' + BufToStr(Buf, I) + '''');}
       Send(@Buf, I);
   except
   end;
end;

Exchanged AnsiStringVar[1] to Pointer(AnsiStringVar)^ (less CPU instructions
involved; may malfunction if any delphi version has default string type
other than AnsiString), and reduced Length function usage (from 6 to 2;
again - less CPU instructions and wasting time for jumping in and out of
Length function). This won't give any *significant* speed boost, but I just
accidently saw that procedure and simply *had* to change it. ;-)

--
Piotr "Hellrayzer" Dalek
Author of ICS-Based Hellcore Mailer - an Outlook Express killer
http://www.hcm.prv.pl
[EMAIL PROTECTED]

----------------------------------------------------------------------
Startuj z INTERIA.PL! >>> http://link.interia.pl/f186c


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to