Recent

Author Topic: [SOLVED] Synapse 40 - SSL/TLS support is not compiled! (on Linux)  (Read 20380 times)

garlar27

  • Hero Member
  • *****
  • Posts: 652
I'm having problems to use THTTPSend with SSL.

I followed this instructions and everything worked fine in windows (well, sort of... I added "ssl_openssl" to the uses but the project refused to compile saying "unit ssl_openssl not found" even though it was included in the package's folder, then I added that file to the lpk and rebuilt Lazarus and THEN it worked).

I went to Linux and did the same with the .lpk and Lazarus. Afterward I compiled the project but I got this message error from

Quote
SSL/TLS support is not compiled!

I placed a breakpoint in the initialization section of ssl_openssl.pas where the plugin is configured but it looks like that this breakpoint wasn't reached. Although a blue dot appears in that line.

Does anybody knows what to do solve this problem?

Thanks in advance.

I'm using an old Lazarus: 1.1; SVN: 40868; FPC: 2.6.2
« Last Edit: July 21, 2014, 10:45:32 pm by garlar27 »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #1 on: July 19, 2014, 10:48:37 am »
Try indicating exactly what you did. The page you mentioned shows multiple options for SSL support...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #2 on: July 21, 2014, 03:08:58 pm »
This is what I've done, and it works on windows but not in Linux:

Code: [Select]
uses
   dateutils, strutils, dom, math, httpsend
   , ssl_openssl // this include the use of the OpenSSL library.
   ;

function TMyClass.SendTransaction(out Response: string; const TheMsg, TheHost, ThePort: string): Boolean;
var
   FHTTP: THTTPSend;
   AStringData: TStringStream;
   SL: TStringList;
   TheHostAndPort: string;
begin
   Result := FALSE;
   Response    := '';
   SL          := nil;
   AStringData := nil;
   if not FileExists(CertificateFile) then begin
      CreateErrorFmt('Certificate File "%S" not found.', [CertificateFile]);
      Exit;
   end;

   FHTTP  := THTTPSend.Create;
   try
      try
         FHTTP.Protocol := '1.1';
         FHTTP.Sock.SSL.CertificateFile := CertificateFile;
         FHTTP.MimeType := 'text/xml';//'application/x-www-form-urlencoded';//
         AStringData := TStringStream.Create(TheMsg);
         FHTTP.Document.LoadFromStream(AStringData);

         if IsEmpty(ThePort) then begin
            TheHostAndPort := 'https://'+ TheHost;
            end
         else begin
            TheHostAndPort := 'https://'+ TheHost +':'+ ThePort;
         end;

         Result := FHTTP.HTTPMethod('POST', TheHostAndPort);
         SL := TStringList.Create;
         SL.LoadFromStream(FHTTP.Document);
         Response := SL.Text;
         if not Result then begin
            CreateErrorFmt('FHTTP.HTTPMethod: FHTTP.ResultCode=[%D: %S]; FHTTP.Sock.SSL.LastError=[%D: %S] (URL: %S)',
                          [FHTTP.Resultcode, FHTTP.ResultString, FHTTP.Sock.SSL.LastError, FHTTP.Sock.SSL.LastErrorDesc, TheHostAndPort]
                          , Response);
            Exit;
         end;
      except
         on E: Exception do begin
            CreateError(GetDumpExceptionCallStack(E));
         end;
      end;
   finally
      FreeAndNil(SL);
      FreeAndNil(AStringData);
      FreeAndNil(FHTTP);
   end;
end; {<--- SendTransaction }

Error message received:
Quote
FHTTP.HTTPMethod: FHTTP.ResultCode=[500: ]; FHTTP.Sock.SSL.LastError=[-1: SSL/TLS support is not compiled!] (URL: https://xxx.xxx.xxx.xxx:xxxxx)

I've created a symlink withthis name "libssl.so" (the library which ssl_openssl.pas is trying to use) pointing to "libssl.so.x.xx.x" and executed "ldconfig" to refresh the libraries.

But the problem remains.

I want to remark that this code works smoothly on windows.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #3 on: July 21, 2014, 03:40:52 pm »
If you are using synapse 40 please be aware that there is a much newer version available.
See
http://wiki.lazarus.freepascal.org/synapse#Installation

I don't know by heart whether cert files are supported by openssl with synapse; you'd have to check the documentation.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #4 on: July 21, 2014, 04:41:14 pm »
If you are using synapse 40 please be aware that there is a much newer version available.
See
http://wiki.lazarus.freepascal.org/synapse#Installation
Well, is the last stable...
May be I should try the snapshot. But first I would like to try to solve it with the stable one.

I don't know by heart whether cert files are supported by openssl with synapse; you'd have to check the documentation.

OpenSSL .cer files are supported by synapse. Is working on Windows, and Linux is where I got problems.

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #5 on: July 21, 2014, 05:07:38 pm »
Have you searched for SSL in the Synapse mailinglist?

http://sourceforge.net/p/synalist/mailman/synalist-public/
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

mica

  • Full Member
  • ***
  • Posts: 196
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #6 on: July 21, 2014, 05:52:34 pm »
You need the devel packages (ssl-devel or whatever it is called) from your distro to compile with SSL.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #7 on: July 21, 2014, 06:10:34 pm »
Well, is the last stable...
May be I should try the snapshot. But first I would like to try to solve it with the stable one.
Hmmm, you're right I'm sorry. I thought there was a stable release end of 2013 but I was obviously mistaken.

As for the trunk version, it's mostly bug fixes & it's been rock solid for me.
I understand though you want to get it working on stable and the problem quite probably is something else (e.g. the -dev packages as mentioned).
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

garlar27

  • Hero Member
  • *****
  • Posts: 652
[SOLVED] Re: Synapse 40 - SSL/TLS support is not compiled! (on Linux)
« Reply #8 on: July 21, 2014, 10:44:58 pm »
Finally

Installing the libssl-dev package solved the problem!!!

Thank you very much!!

 

TinyPortal © 2005-2018