如何让Delphi XE2通过SSL与Google Calendar API通讯? [英] How can I get Delphi XE2 to talk to Google Calendar APIs over SSL?

查看:158
本文介绍了如何让Delphi XE2通过SSL与Google Calendar API通讯?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是时候再次这个问题,但这个时间与Delphi XE2。

It's time for this question again, but this time with Delphi XE2.

我正在使用XE2附带的Indy版本10.5.8.0,我已经尝试了四个不同版本的SSL dll。我试过1.0.x的最新版本,以及大约3个不同的0.9.8版本(e,h,x,....)。

I am using the Indy version 10.5.8.0 that ships with XE2, and I have tried four different versions of the SSL dlls. I have tried 1.0.x latest, and about 3 different 0.9.8 versions (e,h,x,....).

在calendar.google.com上与https://网址通信。 Delphi Google日历组件的作者在 Sync-components.com 上发送自己的二进制
openssl的DLL运行时没有版本信息,但它似乎是一个非常小,非常旧版本的SSL库超过0.9.8。该组件的作者只说他的私有未版本化的DLL是已知的工作。我不敢相信至少有一个版本的openSSL DLL可以很好地与Delphi XE2连接到Google日历。

None of them works, when communicating to https:// urls at calendar.google.com. The author of the Delphi Google Calendar component at "Sync-components.com" ships his own binary openssl DLL runtimes that have no version information in it, but it seems to be a very small, very old version of SSL libs older than 0.9.8. The author of the component says only his private unversioned DLLs are known to work. I can't believe that. Surely at least one version of the openSSL dlls works well enough with Delphi XE2 to connect to Google Calendar.

为了让他的自定义古代DLL加载到Delphi XE2中的Indy 10中,他修改了IdSSLOpenHeaders.pas方法加载,如下所示:

In order to get his custom ancient DLL to load into Indy 10 in Delphi XE2, he modifies IdSSLOpenHeaders.pas method Load, like this, at the end:

 function Load: Boolean;
 begin
   /// ... lots of stuff
   //Result := (FFailedFunctionLoadList.Count = 0); // original.
   Result := (FFailedFunctionLoadList.Count <= 18); // changed to.
 end;

当然,我评估的组件在XE2中不起作用,但我怀疑这是坏的(a)与XE2一起提供的Indy 10的这个特殊快照,或者(b)SSL DLL世界是一个名副其实的破坏你,但适用于我的不同版本的事实。

Of course, the component that I am evaluating does not work in XE2, but I suspect it's the brokenness of either (a) this particular snapshot of Indy 10 that ships with XE2, or (b) the fact that the World of SSL DLLs is a veritable hell of "broken for you but works for me" different versions.

在Delphi XE2中,使用Indy(或任何其他具有SSL支持的delphi组件库),我需要做什么才能获得与Google日历的SSL连接?

What do I have to do to get an SSL connection to Google Calendar, using Indy (or any other delphi component library with SSL support), in Delphi XE2?

或者,如果任何人有一个谷歌日历API实现,与Indy以外的任何其他可以用于测试的工作,我会欣赏链接和指针。

Alternatively, if anyone has a google calendar API implementation that works with anything other than Indy that I could use for testing, I would appreciate links and pointers.

推荐答案

与XE2一起提供的Indy10快照有问题,因为idHTTP对象似乎与OpenSSL不兼容我发现,我无法与任何Google日历服务器服务进行通信。

There is something wrong with the snapshot of Indy10 that ships with XE2, in that the idHTTP object appears not to work well with any of the OpenSSL dlls I found, in that I could not communicate with any Google Calendar server services with them.

问题的实际底层性质似乎是Indy不处理HTTP重定向如我们所希望的那样透明。正在操纵Indy(第三方组件)的代码使用Indyhttp redirect处理逻辑非常难以理解的东西,它似乎是一组解决方法,这些操作不起作用。更令人困惑的是,发生HTTP重定向的代码中的确切位置因测试Google日历的人而异,所以这些重定向故障并不总是出现在测试它们的每个人的相同位置。

The actual underlying nature of the problem seems to be that Indy doesn't handle HTTP redirects as transparently as we might have hoped. The code that is manipulating Indy (third party component) does some really hard to understand things with the Indy "http redirect" handling logic that appears to be a set of workarounds, that don't work. What is furthermore confusing, is that the exact places in the code where HTTP redirects occur varies from one person testing Google Calendars, to another, so these redirect glitches do not always appear in the same places for each person testing it.

请注意,登录方法和方法来获取日历工作。但是,读取事件的方法和代码似乎不起作用。我无法弄清楚两者之间的区别,但我使用的代码是商业的,我不能发布任何内容。我会更新这个消息,如果我已经弄清楚HTTP获取请求在其响应中返回0个字节的实际技术原因如下:

Note that the login method, and method to get the calendars worked. But the methods and code that were to read events, seem not to work. I was unable to figure out the difference between the two, but the code I am using is commercial and I can't post any of it. I will update this message if I ever figure out the actual technical reason that the HTTP get request was returning "0 bytes" in its response for urls like this:

https://www.google.com/calendar/feeds/firstname.lastname%40gmail.com/private/full?max-results=100000

这些零字节的结果是真正的HTTP 302重定向响应代码,我正在使用的代码,没有检查或期望。期待Indy自动处理重定向。

Those zero byte results were really HTTP 302 redirect response code, which the code I was using, did not check for or expect. It was expecting Indy to automatically handle redirects.

问题可能是Indy10版本是非常具体的,只适用于我没有发生的openSSL DLL版本在今天的搜索中找到,或XE2附带的Indy10版本不适用于我可以找到的任何版本的OpenSSL dll,至少不是当它的目标是谷歌的HTTPS日历服务器时。

The problem could either that Indy10 version is very specific and only works with a version of the openSSL dlls that I didn't happen to find in my searching today, or that the Indy10 version that ships with XE2 doesn't work with ANY version of the OpenSSL dlls that I could find, at least not when the target it's talking to is google's HTTPS calendar servers.

我正在运行的代码使用TIdSSLIOHandlerSocketOpenSSL创建一个IdHTTP对象。

The code I am running creates an IdHTTP object with a TIdSSLIOHandlerSocketOpenSSL.

这适用于所有版本的Delphi,直到并包括XE,但是由于使用XE2的Indy版本运送,因此XE2系统因工厂XE2而异。

This works in all versions of Delphi up to and including XE, but breaks with a factory XE2 system, due to the Indy version shipping with XE2.

我发现唯一的修复是安装一个新的夜间版本的Indy,我抓住了4760,似乎工作正常,当与OpenSSL dll版本1.0.1

The only fix I have found is to install a new nightly build of Indy, I grabbed 4760, which appears to work fine, when combined with OpenSSL dll version 1.0.1.

看起来像我喜欢使用OpenSSL与Delphi XE2有点困难开箱即用。非常感谢Indy团队努力工作....但有人可以帮助他们吗?这真的是一个伟大的项目和一个伟大的产品,但是当它破裂,当你必须遵循移动的标准(如openSSL实现),或许更多的文档,测试和眼球将有所帮助。如果有人能告诉我如何帮助我,我随时准备协助。 SSL的问题不是独特的,因为我注意到其他组件供应商和开源人员具有他们支持或不支持的特定版本的OpenSSL dll。

It looks to me like using OpenSSL with Delphi XE2 is a bit difficult out of the box. A huge thank you to the Indy team for working so hard.... But can someone please help them out? This is really a great project and a great product, but when it breaks, and when you have to follow a moving standard (like the openSSL implementation), perhaps a bit more documentation, and testing, and eyeballs would help. I stand ready to assist if anybody can show me how I could help out. The problems with SSL are not indy-specific, as I notice that other component vendors and open source people have specific versions of the OpenSSL dlls that they support or don't support.

我今天学到的另一件悲伤的事情:OpenSSL的一些安装程序默认安装它们的DLL(无警告)到您的Windows System32目录中,不仅导致您的应用程序,其他人,如TortoiseHG和TortoiseSVN,可能会打破。如果您在开始播放之前没有使用SSL的大问题,那么如果您从 OpenSSL网站

Another sad things I learned today: Some of the installers from OpenSSL install their DLLs by default (without warning) into your windows System32 directory, causing not only your app, but others, like TortoiseHG and TortoiseSVN, to perhaps break. If you didn't have a big problem with SSL before you started playing around, you could easily make it worse if you install a bunch of installer-versions from the OpenSSL website.

这篇关于如何让Delphi XE2通过SSL与Google Calendar API通讯?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆