Recent

Author Topic: Synapse https 500  (Read 2662 times)

big_M

  • Jr. Member
  • **
  • Posts: 91
Synapse https 500
« on: November 29, 2019, 05:28:32 pm »
Hi. I installed synapse (as lpk), put ssleay32.dll and libeay32.dll (from here https://indy.fulgan.com/SSL/) in the project folder, and added httpsend and openssl to the uses clause, yet my simple test (from wiki) always fails with error 500 when using a https url (http works just fine).

Now, I am new to http requests, so I don't know if that is related to SSL or my request.

Code: Pascal  [Select][+][-]
  1. function DownloadHTTP(URL, TargetFile: string): Boolean;
  2. var
  3.   HTTPGetResult: Boolean;
  4.   HTTPSender: THTTPSend;
  5. begin
  6.   Result := False;
  7.   HTTPSender := THTTPSend.Create;
  8.   try
  9.     HTTPGetResult := HTTPSender.HTTPMethod('GET', URL);
  10.     showMessage(inttostr(HTTPSender.ResultCode));
  11.     if (HTTPSender.ResultCode >= 100) and (HTTPSender.ResultCode<=299) then begin
  12.       HTTPSender.Document.SaveToFile(TargetFile);
  13.       Result := True;
  14.     end;
  15.   finally
  16.     HTTPSender.Free;
  17.   end;
  18. end;
  19.  
  20. procedure TForm2.Button1Click(Sender: TObject);
  21. begin
  22.   DownloadHTTP('https://www.phoronix.com/phxcms7-css/phoronix.png','E:\phoronix.png');
  23. end;  

What am I missing? (Laz 2.0.6, fpc 3.0.4)

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: Synapse https 500
« Reply #1 on: January 20, 2020, 03:43:14 pm »
I get the same error 500.

I think we don't need to add openssl unit from FPC sources, since synapse has it's own OpenSSL units in the folder. ssl_openssl.pas, but is not accessible from the package (at least the installed with OPM).

Any ideas on how to fix?

rvk

  • Hero Member
  • *****
  • Posts: 6056
Re: Synapse https 500
« Reply #2 on: January 20, 2020, 03:54:16 pm »
First thing I always do when installing the synapse package is add ssl_openssl to it. Somehow it's left out. So just open the synapse package, add ssl_openssl (in the same directory) and compile and save.

After that you can add ssl_openssl to your own unit in the uses and it will be found.

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: Synapse https 500
« Reply #3 on: January 20, 2020, 04:02:09 pm »
First thing I always do when installing the synapse package is add ssl_openssl to it. Somehow it's left out. So just open the synapse package, add ssl_openssl (in the same directory) and compile and save.

After that you can add ssl_openssl to your own unit in the uses and it will be found.

Thankyou, it works now  :)

 

TinyPortal © 2005-2018