Hello.
I have a trouble.
I create TThread class where i using TFPHTTPClient for get https request.
But if i create more than one thread, i have this error.
Project project1 raised exception class 'EInOutError' with message:
Could not initialize OpenSSL library
Simple code.
program project1;
uses
unit1;
var
MYThread: array[0..2] of TMyHTTPRequest;
i: integer;
begin
for i := 0 to 2 do
begin
MYThread[i] := TMyHTTPRequest.Create(True);
MYThread[i].FreeOnTerminate := True;
MYThread[i].Start;
end;
ReadLn;
end.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fphttpclient, sslsockets, fpopenssl;
type
{ TMyHTTPRequest }
TMyHTTPRequest = class(TThread)
public
procedure Execute; override;
end;
implementation
{ TMyHTTPRequest }
procedure TMyHTTPRequest.Execute;
var
Client: TFPHTTPClient;
res: string;
begin
Client := TFPHTTPClient.Create(nil);
res := Client.Get('https://google.com');
FreeAndNil(Client);
end;
end.
Where I am wrong?
Windows 7 x64. Lazarus 1.8.0 SVN Revision 56594.