As has been mentioned several time on this forum, FPC320 has a unit opensslsocket that makes things like HTTPS access easier.
However, it does not seem to be tracking changes in openssl. A table to make it clearer -
Distro Works Version
U18.04 Yes 1.1.1
U19.04 No 1.1.1b
U19.10 No 1.1.1c
Fedora30 No 1.1.1b
Mageia 71 Yes 1.1.0j
Apparently enough has changed between openSSL 1.1.1 and 1.1.1b that our unit cannot cope. Wow, that says to me we are in the middle of a hopeless arms race here, will it ever be a stable interface ?
Is anyone working in this space ? Have a solution ?
As a side issue, all three failed systems (and possibly my U18.04) required manually symlinking the actual libssl.so.somenumber to one of the names that the fpc unit tries, I used libssl.so. That poor unit tries no less than 66 different name combinations before giving up. Most do look like pretty old versions of openssl.
My test app tries to download a github file, and needs FPC 3.2.0 to compile it.
program test_ssl;
{$mode delphi}
// Requires FPC 3.2.0
uses opensslsockets, fphttpclient, sysutils;
procedure DoDownload;
var
client : TFPHTTPClient = nil;
Dest : string;
begin
Dest := GetEnvironmentVariable('PWD') + '/es_notes.zip';
writeln('Dest is ' + Dest);
client := TFPHTTPClient.Create(nil);
Client.AllowRedirect := true;
try
try
client.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');
client.Get('https://github.com/tomboy-notes/tomboy-ng/raw/master/doc/es_notes.zip', Dest);
except
on E: EInOutError do begin
writeln('OpenSSL problem - ' + E.Message);
exit;
end;
on E: Exception do begin
writeln('Unknown Error - ' + E.Message);
exit;
end;
end;
finally
client.free;
end;
end;
begin
DoDownload();
end.