I'm trying to load a TImage starting from an URL as explained in this answer.
uses
GIFImg;
procedure TForm1.Button1Click(Sender: TObject);
var
Stream : TMemoryStream;
GIF : TGIFImage;
begin
Stream := TMemoryStream.Create;
GIF := TGIFImage.Create;
try
IdHTTP1.Get('http://www.google.com/intl/en_ALL/images/logo.gif', Stream);
//IdHTTP1.Get('https://www.google.com/intl/en_ALL/images/logo.gif', Stream);
Stream.Position := 0;
GIF.LoadFromStream(Stream);
Image1.Picture.Assign(GIF);
finally
FreeAndNil(GIF);
FreeAndNil(Stream);
end;
end;
All works good if the URL starts with a simple HTTP.
When I try to load from an HTTPS URL, I get an EIdIOHandlerPropInvalid exception with message:
IOHandler value is not valid.
I've tried adding a TIdSSLIOHandlerSocketOpenSSL and setting it as IOHandler for the TIdHTTP component.

After doing that, I get an EIdOSSLCouldNotLoadSSLLibrary exception with the following message:
Could not load SSL library.
Is there something wrong in the properties or some other problem?
You need the SSL library (two .DLL files) either installed in your Windows, or distributed along with your application.
Seems to be downloadable here:
https://slproweb.com/products/Win32OpenSSL.html
Or via their official web site (but I can't find downloadable binaries there - only source code):
https://www.openssl.org/source/
Pre-compiled .DLLs for use with Indy can be downloaded here:
https://indy.fulgan.com/SSL/ (Thanks, Zed)
When I try to load from an HTTPS URL, I get an
EIdIOHandlerPropInvalidexception with message:IOHandler value is not valid.
That error means you don't have an TIdSSLIOHandlerSocketBase-derived component attached to the TIdHTTP.IOHandler property, such as TIdSSLIOHandlerSocketOpenSSL.
This error also tells me that you are using an outdated version of Indy and need to upgrade. TIdHTTP automatically creates a default SSLIOHandler when requesting an HTTPS url and no IOHandler is currently assigned, and has done so for a long time.
I've tried adding a
TIdSSLIOHandlerSocketOpenSSLand setting it asIOHandlerfor theTIdHTTPcomponent.
That is the correct solution, if you do not want to upgrade, or if you need to customize the SSLIOHandler settings, such as for enabling TLS 1.1+ (which TIdSSLIOHandlerSocketOpenSSL does not do by default yet).
After doing that, I get an
EIdOSSLCouldNotLoadSSLLibraryexception with the following message:Could not load SSL library.
That error means that either
you have not deployed the OpenSSL DLLs (libeay32.dll and ssleay32.dll) with your app, or at least have them installed somewhere on your system's DLL search path.
you are using a version of the DLLs that is incompatible with your version of Indy. The current version of Indy supports OpenSSL 1.0.2 and earlier (support for OpenSSL 1.1.x is currently a work in progress).
After the error is raised, you can use Indy's WhichFailedToLoad() function in the IdSSLOpenSSLHeaders unit to determine the root cause of the failure - whether the DLLs themselves could not be loaded in memory (because they were not found, etc), or because they are missing specific exports that Indy requires.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With