🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
13 messages
13 total messages Started by Oleg Tiktinski Wed, 28 May 2008 02:27
Indy and SSL
#117
Author: Oleg Tiktinski
Date: Wed, 28 May 2008 02:27
13 lines
1326 bytes
I am using Indy tcp client with SSL - working well, however on first 
connect it take around 30-40 seconds to establish connection.
I did some research and find out that on first use Indy call 
LoadSSLLibrary function which do tons of work and slow things down.

Did anyone else had this issue ? Any workaround ?
Problem is that I can't call this function directly I have to make FAKE 
SSL connection in order for Indy to call LoadSSLLibrary.


Thank you for any help.

Oleg.
Re: Indy and SSL
#123
Author: Remy Lebeau (TeamB)
Date: Wed, 28 May 2008 18:54
38 lines
2016 bytes
"Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
news:483cc31b$1@newsgroups.borland.com...

> I am using Indy tcp client with SSL

Which version of Indy are you using?

> I did some research and find out that on first use
> Indy call LoadSSLLibrary function

There is no LoadSSLLibrary() function in Indy.  There is a Load() function 
in the IdSSLOpenSSLHeaders unit, though.

> which do tons of work and slow things down.

Indy dynamically loads each WinSock DLL function on an as-needed basis.  I 
do not know why Indy never did the same thing with the SSL functions.  Most 
likely to make sure that they are all available before allowing any SSL code 
to run.

> Did anyone else had this issue ? Any workaround ?

There is no workaround without re-writing how Indy loads the SSL functions 
internally.

> Problem is that I can't call this function directly

Yes, you can.  The IdSSLOpenSSLHeaders.Load() function is publically 
accessible.

> I have to make FAKE SSL connection in order for Indy to call 
> LoadSSLLibrary.

No, you don't.


Gambit 
Re: Indy and SSL
#126
Author: Oleg Tiktinski
Date: Wed, 28 May 2008 21:33
48 lines
2369 bytes
I am using BCB2007 ( or CodeGear 2007 C++ Builder), Indy10 and I can't 
find  IdSSLOpenSSLHeaders.Load();

there is file IdSSLOpenSSLHeaders.hpp, but I don't see Load anywhere 
there. :(



Remy Lebeau (TeamB) wrote:
> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
> news:483cc31b$1@newsgroups.borland.com...
> 
>> I am using Indy tcp client with SSL
> 
> Which version of Indy are you using?
> 
>> I did some research and find out that on first use
>> Indy call LoadSSLLibrary function
> 
> There is no LoadSSLLibrary() function in Indy.  There is a Load() function 
> in the IdSSLOpenSSLHeaders unit, though.
> 
>> which do tons of work and slow things down.
> 
> Indy dynamically loads each WinSock DLL function on an as-needed basis.  I 
> do not know why Indy never did the same thing with the SSL functions.  Most 
> likely to make sure that they are all available before allowing any SSL code 
> to run.
> 
>> Did anyone else had this issue ? Any workaround ?
> 
> There is no workaround without re-writing how Indy loads the SSL functions 
> internally.
> 
>> Problem is that I can't call this function directly
> 
> Yes, you can.  The IdSSLOpenSSLHeaders.Load() function is publically 
> accessible.
> 
>> I have to make FAKE SSL connection in order for Indy to call 
>> LoadSSLLibrary.
> 
> No, you don't.
> 
> 
> Gambit 
> 
> 
Re: Indy and SSL
#125
Author: Oleg Tiktinski
Date: Wed, 28 May 2008 21:35
51 lines
2522 bytes
Sorry too fast to post I found Load - let me check if it will help.


Oleg Tiktinski wrote:
> I am using BCB2007 ( or CodeGear 2007 C++ Builder), Indy10 and I can't 
> find  IdSSLOpenSSLHeaders.Load();
> 
> there is file IdSSLOpenSSLHeaders.hpp, but I don't see Load anywhere 
> there. :(
> 
> 
> 
> Remy Lebeau (TeamB) wrote:
>> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
>> news:483cc31b$1@newsgroups.borland.com...
>>
>>> I am using Indy tcp client with SSL
>>
>> Which version of Indy are you using?
>>
>>> I did some research and find out that on first use
>>> Indy call LoadSSLLibrary function
>>
>> There is no LoadSSLLibrary() function in Indy.  There is a Load() 
>> function in the IdSSLOpenSSLHeaders unit, though.
>>
>>> which do tons of work and slow things down.
>>
>> Indy dynamically loads each WinSock DLL function on an as-needed 
>> basis.  I do not know why Indy never did the same thing with the SSL 
>> functions.  Most likely to make sure that they are all available 
>> before allowing any SSL code to run.
>>
>>> Did anyone else had this issue ? Any workaround ?
>>
>> There is no workaround without re-writing how Indy loads the SSL 
>> functions internally.
>>
>>> Problem is that I can't call this function directly
>>
>> Yes, you can.  The IdSSLOpenSSLHeaders.Load() function is publically 
>> accessible.
>>
>>> I have to make FAKE SSL connection in order for Indy to call 
>>> LoadSSLLibrary.
>>
>> No, you don't.
>>
>>
>> Gambit
>>
Re: Indy and SSL
#127
Author: Oleg Tiktinski
Date: Wed, 28 May 2008 21:51
97 lines
3499 bytes
Well it did not help:

delay comes from :

procedure TIdSSLIOHandlerSocketOpenSSL.ConnectClient;
on StartSSL; call

inside StartSSL it calls Init which calls

procedure TIdSSLIOHandlerSocketOpenSSL.Init;
begin
   if not Assigned(fSSLContext) then begin
     fSSLContext := TIdSSLContext.Create;
.
.
.




constructor TIdSSLContext.Create;
begin
   inherited Create;

   if DLLLoadCount <= 0 then begin
   	if not IdSSLOpenSSL.LoadOpenSLLibrary then begin
     	raise 	 
EIdOSSLCouldNotLoadSSLLibrary.Create(RSOSSLCouldNotLoadSSLLibrary);
     end;
   end;
   Inc(DLLLoadCount);

   fVerifyMode := [];
   fMode := sslmUnassigned;
   fSessionId := 1;
end;

So this line:

IdSSLOpenSSL.LoadOpenSLLibrary takes lots of time to execute. and I do 
that after IdSSLOpenSSLHeaders::Load();

So I am still not sure how to avoid it :(


Oleg Tiktinski wrote:
> Sorry too fast to post I found Load - let me check if it will help.
> 
> 
> Oleg Tiktinski wrote:
>> I am using BCB2007 ( or CodeGear 2007 C++ Builder), Indy10 and I can't 
>> find  IdSSLOpenSSLHeaders.Load();
>>
>> there is file IdSSLOpenSSLHeaders.hpp, but I don't see Load anywhere 
>> there. :(
>>
>>
>>
>> Remy Lebeau (TeamB) wrote:
>>> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
>>> news:483cc31b$1@newsgroups.borland.com...
>>>
>>>> I am using Indy tcp client with SSL
>>>
>>> Which version of Indy are you using?
>>>
>>>> I did some research and find out that on first use
>>>> Indy call LoadSSLLibrary function
>>>
>>> There is no LoadSSLLibrary() function in Indy.  There is a Load() 
>>> function in the IdSSLOpenSSLHeaders unit, though.
>>>
>>>> which do tons of work and slow things down.
>>>
>>> Indy dynamically loads each WinSock DLL function on an as-needed 
>>> basis.  I do not know why Indy never did the same thing with the SSL 
>>> functions.  Most likely to make sure that they are all available 
>>> before allowing any SSL code to run.
>>>
>>>> Did anyone else had this issue ? Any workaround ?
>>>
>>> There is no workaround without re-writing how Indy loads the SSL 
>>> functions internally.
>>>
>>>> Problem is that I can't call this function directly
>>>
>>> Yes, you can.  The IdSSLOpenSSLHeaders.Load() function is publically 
>>> accessible.
>>>
>>>> I have to make FAKE SSL connection in order for Indy to call 
>>>> LoadSSLLibrary.
>>>
>>> No, you don't.
>>>
>>>
>>> Gambit
>>>
Re: Indy and SSL
#128
Author: Remy Lebeau (TeamB)
Date: Wed, 28 May 2008 22:59
31 lines
2164 bytes
"Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
news:483dd3e1$1@newsgroups.borland.com...

> Well it did not help:

Yes, it does.  Pay closer attention to what you are looking at.

>   if not IdSSLOpenSSL.LoadOpenSLLibrary then begin

LoadOpenSSLLibrary() calls IdSSLOpenSSLHeaders::Load() internally to load 
the OpenSSL DLLs, but only does so once.  So LoadOpenSSLLibrary() can be 
called multiple times, and only the first time will delay.  Subsequent calls 
will exit immediately without doing anything.  LoadOpenSLLibrary() is a 
publically accessible function in the IdSSLOpenSSL unit, so call it anytime 
you want.

> So this line:
>
> IdSSLOpenSSL.LoadOpenSLLibrary takes lots of time to execute.

Only the first time it is called.

> I do that after IdSSLOpenSSLHeaders::Load();

That is your problem.  You are letting IdSSLOpenSSLHeaders::Load() get 
called multiple times.  Don't call it yourself at all anymore.  Call only 
IdSSLOpenSSL::LoadOpenSLLibrary() instead.


Gambit 
Re: Indy and SSL
#129
Author: Oleg Tiktinski
Date: Thu, 29 May 2008 01:49
50 lines
2600 bytes
Please excuse my stupidity, but it's not defined in any header file.
I found this function only in IdSSLOpenSSL.pas
I.e. call  Idsslopenssl::LoadOpenSLLibrary(); will not work since it's 
not part of  Idsslopenssl namespace.
I tried :

extern PACKAGE bool __fastcall LoadOpenSLLibrary(void);

void function()
{
  LoadOpenSLLibrary();
}

it's ok for compiler, but linker failing on it.
What I am doing wrong  ?


Remy Lebeau (TeamB) wrote:
> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
> news:483dd3e1$1@newsgroups.borland.com...
> 
>> Well it did not help:
> 
> Yes, it does.  Pay closer attention to what you are looking at.
> 
>>   if not IdSSLOpenSSL.LoadOpenSLLibrary then begin
> 
> LoadOpenSSLLibrary() calls IdSSLOpenSSLHeaders::Load() internally to load 
> the OpenSSL DLLs, but only does so once.  So LoadOpenSSLLibrary() can be 
> called multiple times, and only the first time will delay.  Subsequent calls 
> will exit immediately without doing anything.  LoadOpenSLLibrary() is a 
> publically accessible function in the IdSSLOpenSSL unit, so call it anytime 
> you want.
> 
>> So this line:
>>
>> IdSSLOpenSSL.LoadOpenSLLibrary takes lots of time to execute.
> 
> Only the first time it is called.
> 
>> I do that after IdSSLOpenSSLHeaders::Load();
> 
> That is your problem.  You are letting IdSSLOpenSSLHeaders::Load() get 
> called multiple times.  Don't call it yourself at all anymore.  Call only 
> IdSSLOpenSSL::LoadOpenSLLibrary() instead.
> 
> 
> Gambit 
> 
> 
Re: Indy and SSL
#130
Author: Remy Lebeau (TeamB)
Date: Thu, 29 May 2008 16:41
45 lines
2286 bytes
"Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
news:483e0ba1$1@newsgroups.borland.com...

> Please excuse my stupidity, but it's not defined in any header file.

Yes, it is - IdSSLOpenSSL.hpp.

> I found this function only in IdSSLOpenSSL.pas

It is declared in the 'interface' section, so it will be included in the 
generated .hpp header file.

> I.e. call  Idsslopenssl::LoadOpenSLLibrary(); will not work
> since it's not part of  Idsslopenssl namespace.

It is present in my copy of Indy 10:

    --- IdSSLOpenSSL.hpp ---

    namespace Idsslopenssl
    {
    //...
    extern PACKAGE bool __fastcall LoadOpenSSLLibrary(void);
    //...
    }

Make sure you are using an up-to-date version.

> I tried :
>
> extern PACKAGE bool __fastcall LoadOpenSLLibrary(void);
>
> void function()
> {
>  LoadOpenSLLibrary();
> }
>
> it's ok for compiler, but linker failing on it.

Check your spelling.  You are missing an 'S' in the name.  And you have to 
include the namespace so the name is mangled properly.


Gambit 
Re: Indy and SSL
#131
Author: Oleg Tiktinski
Date: Thu, 29 May 2008 18:20
52 lines
2542 bytes
I am using version which came with CodeGear 2007

I guess, that may be an issue. Sooo, should I just download new version 
of Indy ?

Remy Lebeau (TeamB) wrote:
> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
> news:483e0ba1$1@newsgroups.borland.com...
> 
>> Please excuse my stupidity, but it's not defined in any header file.
> 
> Yes, it is - IdSSLOpenSSL.hpp.
> 
>> I found this function only in IdSSLOpenSSL.pas
> 
> It is declared in the 'interface' section, so it will be included in the 
> generated .hpp header file.
> 
>> I.e. call  Idsslopenssl::LoadOpenSLLibrary(); will not work
>> since it's not part of  Idsslopenssl namespace.
> 
> It is present in my copy of Indy 10:
> 
>     --- IdSSLOpenSSL.hpp ---
> 
>     namespace Idsslopenssl
>     {
>     //...
>     extern PACKAGE bool __fastcall LoadOpenSSLLibrary(void);
>     //...
>     }
> 
> Make sure you are using an up-to-date version.
> 
>> I tried :
>>
>> extern PACKAGE bool __fastcall LoadOpenSLLibrary(void);
>>
>> void function()
>> {
>>  LoadOpenSLLibrary();
>> }
>>
>> it's ok for compiler, but linker failing on it.
> 
> Check your spelling.  You are missing an 'S' in the name.  And you have to 
> include the namespace so the name is mangled properly.
> 
> 
> Gambit 
> 
> 
Re: Indy and SSL
#132
Author: Remy Lebeau (TeamB)
Date: Thu, 29 May 2008 19:05
15 lines
1655 bytes
"Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
news:483ef3e4$1@newsgroups.borland.com...

> I am using version which came with CodeGear 2007

Then you are using an outdated version of Indy 10.  RAD2007 shipped with the 
same version of Indy that was shipped with RAD2006.

> Sooo, should I just download new version of Indy ?

Yes.


Gambit 
Re: Indy and SSL
#133
Author: Oleg Tiktinski
Date: Thu, 29 May 2008 19:30
21 lines
1814 bytes
Remy Lebeau (TeamB) wrote:
> "Oleg Tiktinski" <oleg@sequoiars.com> wrote in message 
> news:483ef3e4$1@newsgroups.borland.com...
> 
>> I am using version which came with CodeGear 2007
> 
> Then you are using an outdated version of Indy 10.  RAD2007 shipped with the 
> same version of Indy that was shipped with RAD2006.
> 
>> Sooo, should I just download new version of Indy ?
> 
> Yes.
> 
> 
> Gambit 
> 
> 

Problem is that there is no good way of compiling it and installing 
under CodeGear :( .Just got snapshot from Indy svn - I had to modify 
Fulld10.bat to get hpps and obj and libs. ;(
Re: Indy and SSL
#134
Author: Dennis Cote
Date: Thu, 29 May 2008 20:27
13 lines
1764 bytes
Oleg Tiktinski wrote:
> 
> Problem is that there is no good way of compiling it and installing 
> under CodeGear :( .Just got snapshot from Indy svn - I had to modify 
> Fulld10.bat to get hpps and obj and libs. ;(

There are batch files, and instructions to use them, in the 
borland.public.attachments newsgroup that will install a new version of 
Indy in RAD Studio. I reposted them today under the subject "Batch files 
to update Indy 10 in RAD Studio".

HTH
Dennis Cote
Re: Indy and SSL
#135
Author: Oleg Tiktinski
Date: Thu, 29 May 2008 22:10
17 lines
1941 bytes
Thank you !
I will give it a try

Dennis Cote wrote:
> Oleg Tiktinski wrote:
>>
>> Problem is that there is no good way of compiling it and installing 
>> under CodeGear :( .Just got snapshot from Indy svn - I had to modify 
>> Fulld10.bat to get hpps and obj and libs. ;(
> 
> There are batch files, and instructions to use them, in the 
> borland.public.attachments newsgroup that will install a new version of 
> Indy in RAD Studio. I reposted them today under the subject "Batch files 
> to update Indy 10 in RAD Studio".
> 
> HTH
> Dennis Cote
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads