Http Post Indy10 错误 Delphi 7: 创建 SSL 上下文时出错
Http Post Indy10 Error Delphi 7: Error creating SSL context
我将 Delphi 7 与 Indy 10.6.2.5459 一起使用,不时向服务器发出 POST 请求:
sParams := '?ultimaAlteracao='+FormatDateTime('YYYY-MM-DD',now())+'T00:00:00.000';
FidHTTP := TIdHTTP.Create;
try
FidHTTP.Request.Clear;
FidHTTP.Request.Accept := 'application/json;charset=UTF-8';
FidHTTP.Request.CharSet := 'UTF-8';
FidHTTP.Response.ContentType := 'application/json;charset=UTF-8';
FidHTTP.Response.ContentEncoding := 'UTF-8';
FidHTTP.Request.CustomHeaders.AddValue('Authorization','Basic '+EncodeBase64('xx:xx@123456'));
JsonStream := TStringStream.Create('');
JsonStream.Position := 0;
try
FidHTTP.Get('https://'+server+'/LinxImportacaoArquivo/GetSelecaoDadosMDMNCM'+sParams, JsonStream);
DataString := JsonStream.DataString;
finally
FreeAndNil(JsonStream);
end;
finally
FreeAndNil(FidHTTP);
end;
一段时间后,它开始失败并且 returns:
Error creating SSL context. error:140A90F1:SSL
routines:SSL_CTX_new:unable to load ssl2 md5 routines
如果我重新启动应用程序,它会再次工作一段时间。
我发现一些人遇到了同样的问题:here and here
根据我的了解,可能是其他一些使用 Indy 发出干扰请求的进程,我引用
It appears to be an issue with some type of static member
initialization inside the openssl library. I have 2 libraries, both of
them use the openssl library, let's call them A and B. When the
application starts up both A & B are able to successfully create a
security context. Later, when library B tries to create another
security context it fails. Both library A and B are module plugins to
our application so they both will load but if one is not needed it is
unloaded.
事实上,我的应用程序有很多其他进程正在执行,通过 indy10 或 WinInet 发出 http 请求。
所以,我的问题是:是否有一些程序可以调用 Indy10 以使其初始化已在 opensll 库中释放的内容?
我发现在 IdSSLOpenSSL 单元中有一个名为 UnLoadOpenSSLLibrary 的过程。
如果我总是在我的代码之前调用该过程,则不会发生错误。
我将 Delphi 7 与 Indy 10.6.2.5459 一起使用,不时向服务器发出 POST 请求:
sParams := '?ultimaAlteracao='+FormatDateTime('YYYY-MM-DD',now())+'T00:00:00.000';
FidHTTP := TIdHTTP.Create;
try
FidHTTP.Request.Clear;
FidHTTP.Request.Accept := 'application/json;charset=UTF-8';
FidHTTP.Request.CharSet := 'UTF-8';
FidHTTP.Response.ContentType := 'application/json;charset=UTF-8';
FidHTTP.Response.ContentEncoding := 'UTF-8';
FidHTTP.Request.CustomHeaders.AddValue('Authorization','Basic '+EncodeBase64('xx:xx@123456'));
JsonStream := TStringStream.Create('');
JsonStream.Position := 0;
try
FidHTTP.Get('https://'+server+'/LinxImportacaoArquivo/GetSelecaoDadosMDMNCM'+sParams, JsonStream);
DataString := JsonStream.DataString;
finally
FreeAndNil(JsonStream);
end;
finally
FreeAndNil(FidHTTP);
end;
一段时间后,它开始失败并且 returns:
Error creating SSL context. error:140A90F1:SSL routines:SSL_CTX_new:unable to load ssl2 md5 routines
如果我重新启动应用程序,它会再次工作一段时间。 我发现一些人遇到了同样的问题:here and here
根据我的了解,可能是其他一些使用 Indy 发出干扰请求的进程,我引用
It appears to be an issue with some type of static member initialization inside the openssl library. I have 2 libraries, both of them use the openssl library, let's call them A and B. When the application starts up both A & B are able to successfully create a security context. Later, when library B tries to create another security context it fails. Both library A and B are module plugins to our application so they both will load but if one is not needed it is unloaded.
事实上,我的应用程序有很多其他进程正在执行,通过 indy10 或 WinInet 发出 http 请求。
所以,我的问题是:是否有一些程序可以调用 Indy10 以使其初始化已在 opensll 库中释放的内容?
我发现在 IdSSLOpenSSL 单元中有一个名为 UnLoadOpenSSLLibrary 的过程。 如果我总是在我的代码之前调用该过程,则不会发生错误。