如果提供了绑定并使用OpenSSL,则终止时IDE中的Delphi Indy 10 TIdHTTPServer访问冲突(Delphi Indy 10 TIdHTTPServer Access Viol

编程入门 行业动态 更新时间:2024-10-23 04:37:41
如果提供了绑定并使用OpenSSL,则终止时IDE中的Delphi Indy 10 TIdHTTPServer访问冲突(Delphi Indy 10 TIdHTTPServer Access Violation in IDE upon termination if Bindings supplied and using OpenSSL)

使用Indy 10(rev.5128),如果我提供绑定到TIdHTTPServer和使用OpenSSL,II在终止时会在IDE中获得访问冲突。

错误消息如下:Project Project1.exe引发异常类EAccessViolation,并在模块'ssleay32.dll'中显示“在地址1200DBB9处访问冲突”消息。 写下地址FEEEFFDA'。

下面是一个简单的测试用例。 只需创建一个表单,添加用途,然后将下面的代码放在表单create中。 在IDE中运行该应用程序并访问浏览器中的[https:// localhost](您将得不到任何回复),然后关闭该应用程序。 IDE中引发了访问冲突(但正常运行时不会出现异常)。 当然,你需要在运行时使用openssl dll(我使用的是indy.fulgan.com网站上的最新1.0.1g)以及你自己的ssl证书文件。

uses IdHTTPServer, IdSSLOpenSSL; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var HTTPServer:TIdHTTPServer; begin HTTPServer := TIdHTTPServer.Create(Self); with HTTPServer do begin DefaultPort := 443; Bindings.Clear; with Bindings.Add do begin IP := '127.0.0.1'; end; IOHandler := TIdServerIOHandlerSSLOpenSSL.Create(nil); with TIdServerIOHandlerSSLOpenSSL(IOHandler) do begin SSLOptions.RootCertFile := 'localhost.cer'; SSLOptions.CertFile := 'localhost.cer'; SSLOptions.KeyFile := 'localhost.key'; SSLOptions.Method := sslvTLSv1; SSLOptions.VerifyMode := []; SSLOptions.VerifyDepth := 0; end; Active := True; end; end;

如果未提供绑定,则不会出现IDE异常。 在IDE中运行时继续收到错误非常麻烦。 我只需绑定到localhost并且不想绑定到所有地址。

更新:

我已经跟踪并添加了OnException和OnListenerException事件处理程序。 我终止时在OnException事件中收到EAccessViolation异常,并在我的帖子中显示相同的错误消息。 在它到达OnException事件处理程序的第一个行断点之前,IDE中出现异常。 在断点期间,调用堆栈如下:

TForm1.HTTPServerOnException($1892CA0,$18921FC) :0046fa45 TIdCustomTCPServer.DoException + $19 :0041b6bf ThreadProc + $37 :0040400e ThreadWrapper + $2A :74743daa KERNEL32.BaseThreadInitThunk + 0xe :76ef11c1 ntdll.RtlDispatchAPC + 0xcf :76ef1197 ntdll.RtlDispatchAPC + 0xa5

我尝试使用旧的1.0.1f,0.9.8y和0.9.8x OpenSSL DLL,我仍然有相同的例外。

Using Indy 10 (rev. 5128), I I get an access violation in the IDE upon termination if I supply bindings to TIdHTTPServer and when using OpenSSL.

The error message is the following: Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 1200DBB9 in module 'ssleay32.dll'. Write of address FEEEFFDA'.

A simple test case is below. Just create a form, add uses, and put the codes below in the form create. Run the application in the IDE and access the [https://localhost] in the browser (you will get nothing in reply), then close the application. An access violation is raised in the IDE (but the exception does not appear when running normally). Of course, you need to have the openssl dll's when running (I was using the latest 1.0.1g from indy.fulgan.com website) and also your own ssl certificate files.

uses IdHTTPServer, IdSSLOpenSSL; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var HTTPServer:TIdHTTPServer; begin HTTPServer := TIdHTTPServer.Create(Self); with HTTPServer do begin DefaultPort := 443; Bindings.Clear; with Bindings.Add do begin IP := '127.0.0.1'; end; IOHandler := TIdServerIOHandlerSSLOpenSSL.Create(nil); with TIdServerIOHandlerSSLOpenSSL(IOHandler) do begin SSLOptions.RootCertFile := 'localhost.cer'; SSLOptions.CertFile := 'localhost.cer'; SSLOptions.KeyFile := 'localhost.key'; SSLOptions.Method := sslvTLSv1; SSLOptions.VerifyMode := []; SSLOptions.VerifyDepth := 0; end; Active := True; end; end;

If the bindings are not supplied, the IDE exception does not appear. It's just quite bothersome to keep getting the error while running in the IDE. I need to only bind to localhost and do not want to bind to all addresses.

UPDATE:

I have traced and added OnException and OnListenerException event handlers. I am getting an EAccessViolation exception in the OnException event upon termination with the same error message indicated in my post. The exception appears in the IDE just before it reaches the first line breakpoint on the OnException event handler. During the breakpoint, the call stack is the following:

TForm1.HTTPServerOnException($1892CA0,$18921FC) :0046fa45 TIdCustomTCPServer.DoException + $19 :0041b6bf ThreadProc + $37 :0040400e ThreadWrapper + $2A :74743daa KERNEL32.BaseThreadInitThunk + 0xe :76ef11c1 ntdll.RtlDispatchAPC + 0xcf :76ef1197 ntdll.RtlDispatchAPC + 0xa5

I have tried using the older 1.0.1f, 0.9.8y, and 0.9.8x OpenSSL DLLs and I am still having the same exception.

最满意答案

如果您不创建任何绑定,则TIdHTTPServer在内部创建自己的绑定,一个用于IPv4,一个用于IPv6。

由于在调试器外部运行时没有看到异常,因此很可能在运行时捕获,无论是内部的OpenSSL,还是TIdHTTPServer ,甚至是RTL。 将事件处理程序分配给TIdHTTPServer.OnException , TIdHTTPServer.OnListenException和TApplication(Events).OnException事件,并查看是否在其中任何事件中报告了异常。

如果您仍然遇到异常,那么请使用调试器中的调用堆栈更新您的问题,调试器显示导致异常的各种函数调用。

最后,如果您使用任何其他版本的OpenSSL,您是否有相同的例外?

I added IdGlobal in the uses and modified the bindings to have also the IPv6 localhost address and the exception no longer appears.

Bindings.Clear; with Bindings.Add do begin IP := '127.0.0.1'; IPVersion := Id_IPv4; end; with Bindings.Add do begin IP := '::1'; IPVersion := Id_IPv6; end;

Still weird though.

更多推荐

本文发布于:2023-08-07 07:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1462306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   冲突   Delphi   Indy   TIdHTTPServer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!