Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delphi8 problem accessing https: web data - SSL
#6
(02-07-2020, 03:41 AM)rmwatson3rd@gmail.com Wrote: I downloaded them from this site     https://indy.fulgan.com/SSL/

But WHICH ZIP FILE EXACTLY did you download?

(02-07-2020, 03:41 AM)rmwatson3rd@gmail.com Wrote: I put them in a directory      C:\Programs\XE8\SSL_DLL_ForScraping

I have the    Project -> Options -> Search Path  going thru this directory

That is not necessary.  That option has no effect on your app at runtime, and the DLLs are not used at compile-time.

(02-07-2020, 03:41 AM)rmwatson3rd@gmail.com Wrote: On FormCreate I added this code:
Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
  SSLDir := 'c:\programs\XE8\SSL_DLL_ForScraping';
  IdOpenSSLSetLibPath(SSLDir);
end;

That code is OK.

(02-07-2020, 03:41 AM)rmwatson3rd@gmail.com Wrote: This is the code:

Putting the call to WhichFailedToLoad() right after the call to TIdHTTP.Get() doesn't work because the error is reported as a raised exception.  So you need a try..except block to catch that exception, eg:

Code:
function GetPage(aURL: string): string;
var
  HTTP: TIdHTTP;
begin
  Result := '';
  try
   HTTP := TIdHTTP.Create(nil);
    try
      Result := HTTP.Get(aURL);
    finally
      HTTP.Free;
   end;
  except
    on Exception do begin
      // TODO -cLogging: add some logging
      // call WhichFailedToLoad() here...
    end;
  end;
end;

(02-07-2020, 01:26 PM)Jose Nilton Pace Wrote: Hi Bob, to consume HTTPS you need:
Code:
IdHTTP.IOHandler := IdSSLIOHandlerSocketOpenSSL;

FYI, TIdHTTP handles that automatically by default.  You don't need to assign an SSLIOHandler explicitly, unless you need to customize the SSLIOHandler (specify certificates, enable TLS 1.1/1.2, etc).  Bob would not be getting a "could not load SSL library" error if TIdSSLIOHandlerSocketOpenSSL were not being assigned to TIdHTTP.  He would be getting an "IOHandler value is not valid" error instead.

Reply


Messages In This Thread
RE: Delphi8 problem accessing https: web data - SSL - by rlebeau - 02-08-2020, 01:30 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)