Recent

Author Topic: opensslsockets and FPC320  (Read 2942 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
opensslsockets and FPC320
« on: November 16, 2019, 06:57:46 am »
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.

Code: Pascal  [Select][+][-]
  1. program test_ssl;
  2. {$mode delphi}
  3. // Requires FPC 3.2.0
  4.  
  5. uses opensslsockets, fphttpclient, sysutils;
  6.  
  7. procedure DoDownload;
  8. var
  9.       client : TFPHTTPClient = nil;
  10.       Dest : string;
  11. begin
  12.       Dest := GetEnvironmentVariable('PWD') + '/es_notes.zip';
  13.       writeln('Dest is ' + Dest);
  14.       client := TFPHTTPClient.Create(nil);
  15.       Client.AllowRedirect := true;
  16.       try
  17.         try
  18.         client.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');
  19.         client.Get('https://github.com/tomboy-notes/tomboy-ng/raw/master/doc/es_notes.zip', Dest);
  20.         except
  21.           on E: EInOutError do begin
  22.               writeln('OpenSSL problem - ' + E.Message);
  23.               exit;
  24.               end;
  25.           on E: Exception do begin
  26.               writeln('Unknown Error - ' + E.Message);
  27.               exit;
  28.               end;
  29.         end;
  30.       finally
  31.         client.free;
  32.       end;
  33. end;
  34.  
  35. begin
  36.       DoDownload();
  37. end.
  38.  


Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018