lnet http problem - Needs OpenSSL library lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- szocsmarci · 2011-03-29 09:00 Hi I have a a problem with lnet. Newly installed Lazarus (0.9.30) + FPC 2.4.2 + lnet 0.6.5 In the example program - visual/http/httpclienttest - it quits with this message: Unable to initialize OpenSSL library, please Check your OpenSSL installation. I read that lnet doesn't have other dependecies - no need other libraries than FPC and lazarus. I found the OpnSSL directory in the FPC/2.4.2/source and in the FPC/2.4.2/units directories too, so FPC contains them. What do I need to do to install OpenSSL? ---------------------------------------------------------------------- Dibo · 2011-03-29 10:32 On linux systems OpenSSL is installed by default. On windows you should install OpenSSL librarys: http://www.openssl.org/related/binaries.html If installer doesn't copy libeay32.dll and ssleay32.dll to Windows\System32 folder then you should do this manually (You find them in OpenSSL installation dir). You can copy this librarys to your exe dir instead of System32. ---------------------------------------------------------------------- szocsmarci · 2011-03-30 06:33 Thanks it works!  But why it is written, that lnet had no dependecies (except FPC, and Lazarus)? ---------------------------------------------------------------------- ik · 2011-03-30 07:59 And system libraries that it is using, like *all* the code you write ... ---------------------------------------------------------------------- Dibo · 2011-03-30 12:10 I have question about OpenSSL too. Can I include this librarys into installator of my application without breaking the OpenSSL license? I just want that user download my program and run without installation external librarys. How it works on internet browser? They using somehow SSL and I don't need install OpenSSL ---------------------------------------------------------------------- marcov · 2011-03-30 15:01 Quote from: Dibo on March 30, 2011, 02:10:18 pmI have question about OpenSSL too. Can I include this librarys into installator of my application without breaking the OpenSSL license? I just want that user download my program and run without installation external librarys. How it works on internet browser? They using somehow SSL and I don't need install OpenSSL It's in the installer. E.g. Mozilla firefox has a libssl3.dll in its Windows install. ---------------------------------------------------------------------- Almindor · 2011-03-31 10:49 Quote from: szocsmarci on March 30, 2011, 08:33:39 amThanks it works! But why it is written, that lnet had no dependecies (except FPC, and Lazarus)? lNet itself has no dependencies, and produces "smartlinked" code with FPC. OpenSSL support however is a functionality requiring external library and if you use it (TLSSLSession) then you will need this library. One could write a SSL library in FPC for example, but that's a huge undertaking and is also risky (openSSL is tried and true, and responds to security issues). For distribution needs, you can include the openSSL library (dll) for windows in your application provided you comply with their license (I think a readme might be sufficient). ---------------------------------------------------------------------- Raul_ES · 2019-05-11 00:02 Hi! today 11-5-2019 I still have this exact problem when running LNet samples, both in Windows and Linux. Anyone else has the same issue? ---------------------------------------------------------------------- JimD · 2019-05-17 15:35 Hi Raul, This example works for me on Windows. I downloaded the OpenSSL 1.0.2r windows binaries reference this post: https://forum.lazarus.freepascal.org/index.php/topic,44554.msg313449.h tml#msg313449 I copied the libeay32.dll and ssleay32.dll files in the same folder: lnet\examples\visual\http I tested with the url https://google.com My Config: Win10 Home 64-bit, Lazarus 1.8.2, FPC 3.0.4 64 ---------------------------------------------------------------------- trev · 2019-06-20 11:48 For Windows I use Microsoft's WinInet API (https://docs.microsoft.com/en-us/windows/desktop/wininet/wininet- reference): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IFDEF WINDOWS}// Need to use Windows WinInet to avoid issue with HTTPS// needing two OpenSSL DLLs to be provided with application// if using TFPHttpClient.// The WinINet API also gets any connection and proxy settings// set by Internet Explorer... curse or blessing? function GetSSLPage(const Url: string): string;var  NetHandle: HINTERNET;  UrlHandle: HINTERNET;  Buffer: array[0..1023] of Byte;  BytesRead: dWord;  StrBuffer: UTF8String;begin  Result := '';  NetHandle := InternetOpen('Mozilla/5.0(compatible; WinInet)', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);   // NetHandle valid?  if Assigned(NetHandle) then    Try      UrlHandle := InternetOpenUrl(NetHandle, PChar(Url), nil, 0, INTERNET_FLAG_RELOAD, 0);       // UrlHandle valid?      if Assigned(UrlHandle) then        Try          repeat            InternetReadFile(UrlHandle, @Buffer, SizeOf(Buffer), BytesRead);            SetString(StrBuffer, PAnsiChar(@Buffer[0]), BytesRead);            Result := Result + StrBuffer;          until BytesRead = 0;        Finally          InternetCloseHandle(UrlHandle);        end      // o/w UrlHandle invalid      else        raise Exception.CreateFmt('Cannot retrieve %s', [Url]);    Finally      InternetCloseHandle(NetHandle);    end  // NetHandle invalid  else    raise Exception.Create('Unable to initialise WinInet');end;{$ENDIF}  You need to add WinInet to the Uses clause.