gpt4 book ai didi

Delphi 2007 Indy 10 找不到 SSL 库

转载 作者:太空宇宙 更新时间:2023-11-03 13:25:27 25 4
gpt4 key购买 nike

我正在使用 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,并没有像我上面所说的那样工作。怎么了?这是一个错误吗?

最佳答案

根据 this,在让一个 dll 工作之前,我必须测试许多 dll。 answer 我需要特定版本的 dll。在努力和测试所有 openssl 版本之后 provided by Indy , 9.6 one为我工作。

关于Delphi 2007 Indy 10 找不到 SSL 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33367151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com