Hi,
I'm having similar problems to other folk in that requests to an http resource work fine, but those to https return the error:
ElnOutError Could not initialise OpenSSL library
I've read all recent posts on this topic and have tried all the suggestions mentioned in them but to no effect.
I've manually installed openssl.1.0.2 from source. I've also tried adding copies of the libssl and libcrypto files to the project directory.
System details:
--------------------------------
fpc: 3.0.4
lazarus: 1.8.2
x86_64-linux-gtk2
Fedora 29
--------------------------------
$which openssl
/usr/bin/openssl
$openssl version
OpenSSL 1.1.1 FIPS 11 Sep 2018
One slight oddity of Fedora is that the ssl library files are in /lib64 rather than /usr/lib64. I've added this to LD_LIBRARY_PATH in my .bashrc file. The current library path is:
:/lib64:/lib:/usr/lib:/usr/local/lib
in /lib64 the relevant libssl files are:
lrwxrwxrwx. 1 root root 16 Nov 23 20:07 libssl1.so -> libssl.so.1.0.2o
-rwxr-xr-x. 1 root root 409128 Sep 3 13:40 libssl3.so
lrwxrwxrwx. 1 root root 16 Aug 3 10:51 libssl.so.10 -> libssl.so.1.0.2o
-rwxr-xr-x. 1 root root 474456 Aug 3 10:51 libssl.so.1.0.2o
lrwxrwxrwx. 1 root root 15 Sep 17 12:03 libssl.so.1.1 -> libssl.so.1.1.1
-rwxr-xr-x. 1 root root 623016 Sep 17 12:03 libssl.so.1.1.1
similar for libcrypto:
lrwxrwxrwx. 1 root root 21 Oct 8 14:08 libbd_crypto.so.2 -> libbd_crypto.so.2.0.0
-rwxr-xr-x. 1 root root 47736 Oct 8 14:08 libbd_crypto.so.2.0.0
lrwxrwxrwx. 1 root root 19 Nov 23 20:06 libcrypto1.so -> libcrypto.so.1.0.2o
lrwxrwxrwx. 1 root root 19 Aug 3 10:51 libcrypto.so.10 -> libcrypto.so.1.0.2o
-rwxr-xr-x. 1 root root 2692984 Aug 3 10:51 libcrypto.so.1.0.2o
lrwxrwxrwx. 1 root root 18 Sep 17 12:03 libcrypto.so.1.1 -> libcrypto.so.1.1.1
-rwxr-xr-x. 1 root root 3192840 Sep 17 12:03 libcrypto.so.1.1.1
lrwxrwxrwx. 1 root root 18 Oct 9 22:04 libk5crypto.so.3 -> libk5crypto.so.3.1
-rwxr-xr-x. 1 root root 144440 Oct 9 22:04 libk5crypto.so.3.1
The code is pretty much what's in the documentation:
unit httpclientunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
fphttpclient, openssl;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var S: String;
var myClient: TFPHttpClient;
begin
InitSSLInterface;
myClient := TFPHttpClient.Create(nil);
with myClient do
try
AllowRedirect:=true;
S:=Get('https://jsonplaceholder.typicode.com/todos/5');
Memo1.text:=S;
finally
free;
end;
end;
end.