Delphi 2007 and Indy 10 using https and SSL

2019-07-31 17:57发布

I've dropped a TIdHTTP and a TIdSSLIOHandlerSocketOpenSSL, set the IOHandler of the IdHTTP to the SSL handler, set the mode of the TIdSSLIOHandlerSocketOpenSSL to sllmClient. And then added the button click event below. The first time I get this error from WhichFailedToLoad.

enter image description here

Displayed, the second time I press the button it works. The ssl dll's are in the .exe diretory.

The service works fine from the browser and is in production. Why doesn't it work the first time?

procedure TForm32.Button1Click(Sender: TObject);
var
  output : TMemoryStream;
begin
    output:=TMemoryStream.Create;
//    IdOpenSSLSetLibPath(
  try
    IdHTTP1.get('https://localhost:444/Folder/service.svc',output);
    output.position := 0;
    memo1.lines.LoadFromStream(output);
  except
    on exception do
    ShowMessage(WhichFailedToLoad());
  end;
end;

tia

标签: delphi indy
2条回答
Evening l夕情丶
2楼-- · 2019-07-31 18:19

You should update to the latest version of Indy and the ssl dlls's, this should get rid of the exception altogether.

查看更多
Viruses.
3楼-- · 2019-07-31 18:24

You must be using a really old and outdated version of Indy 10 - most of the reported functions in that message box have an _Indy suffix on them.

Indy 9 and earlier, and early Indy 10 releases, require custom-built OpenSSL DLLs that add Indy-specific functions to access internal OpenSSL data that was not yet exposed in the public OpenSSL API. Once that data was exposed in later API releases, Indy 10 was updated to no longer require the custom-built DLLs anymore. It now uses the standardized OpenSSL DLLs as-is.

So you either need to track down the old custom-built Indy OpenSSL DLLs, or you need to upgrade to an up-to-date Indy 10 version.

查看更多
登录 后发表回答