更新后印地不再工作了
我在使用 Indy 时遇到了各种各样的问题,按照某人的建议(在 stackoverflow)我已经更新到了 Indy 的最新版本 - 至少这是我打算做的。
在开始安装之前,我已经从我的 Delphi 和注册表中手动删除了所有包含“indy”字样的文件。然后我遵循标准安装过程: http://www.indyproject.org /sockets/Docs/Indy10Installation.en.aspx
现在下面的代码不再起作用。代码只是返回 FALSE;
function Download(CONST aSourceURL: string; CONST aDestFileName: string; OUT aErrm: String): Boolean;
VAR
Stream: TMemoryStream;
IDAntiFreeze: TIDAntiFreeze;
fIDHTTP : TIDHTTP;
begin
fIDHTTP := TIDHTTP.Create(NIL);
// fIDHTTP.ConnectTimeout:=5000; <- not recognized
fIDHTTP.ReadTimeout:= 1000;
fIDHTTP.HandleRedirects := TRUE;
fIDHTTP.AllowCookies := FALSE;
fIDHTTP.Request.UserAgent := 'Mozilla/4.0';
fIDHTTP.Request.Connection := 'Keep-Alive';
fIDHTTP.Request.ProxyConnection := 'Keep-Alive';
fIDHTTP.Request.CacheControl := 'no-cache';
IDAntiFreeze := TIDAntiFreeze.Create(NIL);
Stream := TMemoryStream.Create;
TRY
TRY
fIDHTTP.Get(aSourceURL, Stream);
{
if FileExists(aDestFileName)
then DeleteFile(PWideChar(aDestFileName)); }
Stream.SaveToFile(aDestFileName);
Result:= TRUE;
EXCEPT
On E: Exception do
begin
Result:= FALSE;
aErrm := E.Message + ' (' + IntToStr(fIDHTTP.ResponseCode) + ')';
end;
END;
FINALLY
Stream.Free;
IDAntiFreeze.Free;
fIDHTTP.Free;
END;
end;
有什么方法可以查看我安装了哪个版本的 Indy?
编辑: 我还收到一条“Unit idHTTP 是使用不同版本的 IdException.IdException 编译的”消息。 已修复。
I had all kind of problems with Indy and following someone’s recommendations (at stackoverflow) I have updated to the latest version of Indy - at least this is what I intended to do.
Before starting the installation, I have manually deleted all files containing the "indy" word from my Delphi and from registry. Then I have followed the standard install procedure: http://www.indyproject.org/sockets/Docs/Indy10Installation.en.aspx
Now the piece of code below is not working anymore. The code just returns FALSE;
function Download(CONST aSourceURL: string; CONST aDestFileName: string; OUT aErrm: String): Boolean;
VAR
Stream: TMemoryStream;
IDAntiFreeze: TIDAntiFreeze;
fIDHTTP : TIDHTTP;
begin
fIDHTTP := TIDHTTP.Create(NIL);
// fIDHTTP.ConnectTimeout:=5000; <- not recognized
fIDHTTP.ReadTimeout:= 1000;
fIDHTTP.HandleRedirects := TRUE;
fIDHTTP.AllowCookies := FALSE;
fIDHTTP.Request.UserAgent := 'Mozilla/4.0';
fIDHTTP.Request.Connection := 'Keep-Alive';
fIDHTTP.Request.ProxyConnection := 'Keep-Alive';
fIDHTTP.Request.CacheControl := 'no-cache';
IDAntiFreeze := TIDAntiFreeze.Create(NIL);
Stream := TMemoryStream.Create;
TRY
TRY
fIDHTTP.Get(aSourceURL, Stream);
{
if FileExists(aDestFileName)
then DeleteFile(PWideChar(aDestFileName)); }
Stream.SaveToFile(aDestFileName);
Result:= TRUE;
EXCEPT
On E: Exception do
begin
Result:= FALSE;
aErrm := E.Message + ' (' + IntToStr(fIDHTTP.ResponseCode) + ')';
end;
END;
FINALLY
Stream.Free;
IDAntiFreeze.Free;
fIDHTTP.Free;
END;
end;
There is any way to see which version of Indy I have installed?
Edit:Also I get an "Unit idHTTP was compiled with a different version of IdException.IdException" message. Fixed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该首先使用 Delphi 安装程序卸载与 Delphi 一起安装的 Indy 版本 - 然后您可以清理任何剩余文件。您不应该从手动清理文件夹和注册表开始。
然后你可以安装另一个版本。请注意,某些版本正在“中断”
You should first use the Delphi setup to uninstall the version of Indy that is installed with Delphi - then you can cleanup any remaining file. You should not start by cleaning folders and registry by hand.
Then you can install another version. Be aware some releases are "breaking"