本文介绍了Indy 10.6.0.5169 + OpenSSL 1.0.2u + Delphi XE7,握手错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Indy从网站上获取数据,但无法正常工作.我收到以下错误:
I would like to get data from a website using Indy, but its not working.I get the following error:
这是代码:
var
AMS: TMemoryStream;
begin
AMS := TMemoryStream.Create;
try
IdHTTP1.Get('https://www.optionsprofitcalculator.com/ajax/getStockPrice?stock=hca&reqId=0', AMS);
AMS.SaveToFile('c:\test.txt');
finally
FreeAndNil(AMS);
end;
end;
以及组件:
object IdHTTP1: TIdHTTP
IOHandler = IdSSLIOHandlerSocketOpenSSL1
AllowCookies = True
HandleRedirects = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.Connection = 'keep-alive'
Request.ContentLength = -1
Request.ContentRangeEnd = -1
Request.ContentRangeStart = -1
Request.ContentRangeInstanceLength = -1
Request.Accept =
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp' +
',*/*;q=0.8'
Request.AcceptEncoding = 'gzip, deflate, br'
Request.AcceptLanguage = 'hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3'
Request.BasicAuthentication = False
Request.UserAgent =
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:77.0) Gecko/20100101' +
' Firefox/77.0'
Request.Ranges.Units = 'bytes'
Request.Ranges = <>
HTTPOptions = [hoForceEncodeParams]
Left = 110
Top = 155
end
object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
MaxLineAction = maException
Port = 0
DefaultPort = 0
SSLOptions.Method = sslvSSLv23
SSLOptions.SSLVersions = [sslvSSLv2, sslvSSLv3, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0
Left = 155
Top = 155
end
我不知道问题出在哪里.如果Indy无法实现,我想知道是否有任何标准的Delphi组件与HTTPS服务器通信?
I have no clue where the problem is. If it cannot be achieved with Indy, I would like to know if there is any standard Delphi component to communicate with HTTPS servers?
推荐答案
奥秘得以解决.
提到的网站使用的是Indy尚不支持的TLS 1.3.
The mentioned site using TLS 1.3 which not supported by the Indy, yet.
感谢雷米·勒博,他在这项调查中为我提供了帮助.
Thanks to Remy Lebeau, who helped me in this investigation.
这篇关于Indy 10.6.0.5169 + OpenSSL 1.0.2u + Delphi XE7,握手错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!