如何使用旧的indy9包中的组件

时间:2013-08-07 10:25:27

标签: delphi indy10 httpserver indy-9

我已经在Delphi7中将Indy9升级到Indy10。花了一些时间让我用TCP服务器和客户端更改所有部件,但现在似乎很好用。

现在,我注意到一部分仍然无效,那就是idHTTPserver组件。

我们的应用程序网页使用的是mootools库。使用Indy9 idHTTPserver它可以很好地工作,但是Indy10做了一些事情,这使浏览器无法显示页面。

除了一些其他错误之外,还有像(Firefox错误控制台输出)这样的无意义错误:

Timestamp: 2013.08.07 13:13:56
Error: SyntaxError: missing ] after element list
Source File: http://192.168.100.2:8780/lib/ui/core/mootools-1.2.4-more-yc.js
Line: 103, Column: 60
Source Code:
unction(){var b=["C?","C ","C","C?","C,","C¢","Cƒ","C£","C"","C¤","C.","C?","Ä,","ă","Ä"","Ä.","Ä?","Ä?","ÄŒ","Ĩ","C?
-------------------------------------------------------------^

此.js中的实际源代码是:

long long text ....... function(){var b=["C?","C ","C","C?","C,","C¢","Cƒ","C£","C"","C¤","C.","C?","Ä,","ă","Ä"","Ä.","Ä?","Ä?","ÄŒ","Ĩ","C?","C§","Ä?","ĸ","Ä","Ä'","Cˆ","CØ","C?","C©","CŠ","CR","C<","C«","Äš","Ä>","Ę","ÄT","Ä?","ÄŸ","CŒ","C¬","C¨","C­","C?","C®","C¸","CÆ","Ĺ","Är","Ľ","ľ","Å","Å,","C'","C±","Å?","ň","Ń","Å"","C'","C²","C"","C³","C"","C´","C.","Cµ","C-","C¶","C˜","Cø","Å'","Ř","ÅT","Å"","Å.","Å ","Å?","Å?","ÅŸ","Åš","Å>","Ť","Å?","Ť","Å?","Å¢","Å£","CT","C¹","Cš","Cr","C>","C»","Cœ","C¼","Å®","ÅÆ","Åø","Cæ","C½","C¯","Ž","ž","Ź","År","Å»","ż","C?","C¾","C","C°","CŸ","Å'","Å"","C?","C¦","Aµ"]; ................ long long text

这里发生了什么?

我深吸一口气思考,嘿,我可以使用旧版本的idHTTPserver,因为我仍然在另一个文件夹中有Indy9的源文件。 如果没人知道如何修复indy10 HTTPserver,有人可以告诉我如何使用旧版本?只是HTTPserver组件(它肯定与10个其他旧的indy文件链接)。

我试图包含旧的源代码,但它变得一团糟,因为它将使用旧版本的idHTTPserver.pas,但是idCustomHTTPserver.pas(这是我在使用idHTTPserver.pas文件后发生的事情)来自新版本......

2 个答案:

答案 0 :(得分:0)

要在一个项目中使用不同的Indy版本,请将项目搜索路径设置为Indy \ Lib \ Core,\ Protocols和\ System,并在代码中实例化所有组件。

这样做的另一个好处是,您可以避免卸载/安装步骤在不同的Indy 10版本之间切换。

答案 1 :(得分:0)

虽然这不能直接回答我自己的标题问题,但这确实解决了我的问题。

我跟着HTTPserver.WriteContent,它引导到idHTTPServer.pas,Indy9和Indy10,然后的相比idHTTPServer.pas文件有关Indy10编码部件引起我的注意的功能。

在第2039行,我删除了写函数的第二个参数

FConnection.IOHandler.Write(ContentText, CharsetToEncoding(CharSet));
换成了   FConnection.IOHandler.Write(ContentText);

这解决了我的问题。现在一切都很好。

正如评论者所注意到的,这里的主要问题是额外的“符号”。 我是非常愚蠢的,因为我点击了firefox控制台中的链接,它打开了错误的版本的javascript文件,由于某种原因,我认为这是它应该是什么。只是稍后我决定检查我的电脑上的实际文件,结果发现"C""甚至不是C,实际文本是这个

var b=["À","à","Á","á","Â","â","Ã","ã","Ä","ä","Å","å","Ă","ă","Ą","ą","Ć","ć","Č","č","Ç","ç","Ď","ď","Đ","đ","È","è","É","é","Ê","ê","Ë","ë","Ě","ě","Ę","ę","Ğ","ğ","Ì","ì","Í","í","Î","î","Ï","ï","Ĺ","ĺ","Ľ","ľ","Ł","ł","Ñ","ñ","Ň","ň","Ń","ń","Ò","ò","Ó","ó","Ô","ô","Õ","õ","Ö","ö","Ø","ø","ő","Ř","ř","Ŕ","ŕ","Š","š","Ş","ş","Ś","ś","Ť","ť","Ť","ť","Ţ","ţ","Ù","ù","Ú","ú","Û","û","Ü","ü","Ů","ů","Ÿ","ÿ","ý","Ý","Ž","ž","Ź","ź","Ż","ż","Þ","þ","Ð","ð","ß","Œ","œ","Æ","æ","µ"];

所以,我是对的。当整个文本通过CharsetToEncoding时,它会将所有这些单个符号字符转换为2个符号。

我也不会接受我自己的答案,因为它并没有真正回答这个标题的问题,我很想知道,如果它可以使用旧版本的单一成分,而其余的都是新的。