簡體   English   中英

Delphi 2007 Indy 10找不到SSL庫

[英]Delphi 2007 Indy 10 Cannot find SSL library

我正在使用Delphi 2007和Indy 10來發出https發布請求,我正在使用httpbin進行測試,但它不起作用...

First chance exception at $77503E28. Exception class EIdOSSLCouldNotLoadSSLLibrary with message 'Could not load SSL library.'. Process Recarga.exe (21392)

這是我的代碼:

unit UMAIN;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdHttp, IdMultipartFormData, IdSSLOpenSSL;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
const
  URL = 'https://httpbin.org/post';
var
  idHttp: TIdHTTP;
  data: TIdMultiPartFormDataStream;
  retorno: string;
  LHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
  idHttp:= TIdHTTP.Create(nil);
  data := TIdMultiPartFormDataStream.Create;
  LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  with LHandler do
    begin
      SSLOptions.Method := sslvSSLv2;
      SSLOptions.Mode := sslmUnassigned;
      SSLOptions.VerifyMode := [];
      SSLOptions.VerifyDepth := 0;
      host := '';
    end;

  data.AddFormField('serv', 'atualizar');

  try
    try
      idHttp.IOHandler := LHandler;
      idHttp.Request.Accept := 'text/html, */*';
      idHttp.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0';
      idHttp.Request.ContentType := 'application/x-www-form-urlencoded';
      idHttp.HandleRedirects := True;
      retorno := UTF8Decode(idHttp.Post(URL, data));
      ShowMessage('Resultado: ' + retorno);
    except on E: Exception do
      ShowMessage('Erro: ' + E.Message);
    end;
  finally
    LHandler.Free;
    idHttp.Free;
  end;

end;

end.

在SO和其他站點上我已經讀到我需要libeay32.dllssleay32.dll庫,但是我確實擁有它們,並且它們位於我的最終exe文件所在的目錄中,並且沒有任何作用如上所述。 怎么了? 那是個錯誤嗎?

我必須先測試許多dll才能工作,根據答案,我需要特定版本的dll。 經過努力並測試了Indy提供的所有openssl版本后, 9.6版對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM