Indy “Could not load SSL library” Delphi XE2 IW14

坚强是说给别人听的谎言 提交于 2019-12-01 18:15:44

问题


I know this question has been asked before but none of the answers seem to be appropriate for this situation.

I'm using a TIdHttp component with an SSL handler. My code is as follows:

  idHTTPClient := TIdHTTP.Create(nil);
  ioHnd := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  ioHnd.DefaultPort := iSSL_PORT;
  ioHnd.SSLOptions.Mode := sslmClient;
  idHTTPClient.IOHandler := ioHnd;
  idHTTPClient.Request.AcceptEncoding := 'gzip,deflate,identity';
  idHTTPClient.Request.BasicAuthentication := False;

  try
    idHTTPClient.Post(FFQDN, stmRequest, stmResponse);
  except
    on E:Exception do
    begin
      if IdSSLOpenSSLHeaders.WhichFailedToLoad <> '' then
      begin
        AddMsg('Failed to load file ' + IdSSLOpenSSLHeaders.WhichFailedToLoad + '. ' + E.Message);
      end;
    end;
  end;

There are three versions of the ssleay32 and libeay32.dll files on the machine. One set is in the same folder as my executable (V1.0.0.5). One set is in the Apache bin folder (V0.9.8.20) and one set is in C:\Windows\SysWOW64 (no version but dated 2003).

When the app starts it runs fine. But after a few days the Post call starts to fail with "Could not load SSL library". The files which fail to load are:

SSL_SESSION_get_id,SSL_COMP_get_compression_methods

Once this problem starts to happen it won't go away until the app is restarted. Then it works fine again for another few days.

It would seem to me that for some reason the dlls being loaded change after a few days. How could this happen and what could I do to ensure the correct files are loaded every time?


回答1:


Ideally, delete all the other versions of OpenSSL DLLs on your machine to ensure that your app always finds the correct DLL. Its the multiple versions and processes (Apache) loading these different versions that is causing the conflict.



来源:https://stackoverflow.com/questions/25046585/indy-could-not-load-ssl-library-delphi-xe2-iw14

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!