[英]Even if SslOptions are set i keep having “Socket Error # 10054 Connection reset by peer.” in Indy using TIdHTTP doing get from https url
I am using TIdHTTP
to get from a https URL, my code works fine until http is used, but on https i have I am using TIdHTTP
to get from a https URL, my code works fine until http is used, but on https i have
Socket Error # 10054 Connection reset by peer.套接字错误#10054 连接被对等方重置。
In many SO answers I Read about TLS 1.0 being the default so I tried to set it to TLS 1.2在许多 SO 答案中,我读到 TLS 1.0 是默认设置,因此我尝试将其设置为 TLS 1.2
I experimented by changing many properties in TIdHTTP
and TIdSSLIOHandlerSocketOpenSSL
but with no success.我通过更改TIdHTTP
和TIdSSLIOHandlerSocketOpenSSL
中的许多属性进行了实验,但没有成功。
The URL against which this fails is https://nesufficio.my.qualibus.it/FeriePermessiDemo/DOQualibus/QappCommandHandler
.失败的 URL 是https://nesufficio.my.qualibus.it/FeriePermessiDemo/DOQualibus/QappCommandHandler
。
There is an handshake issue I am not able to overcome, if I disable the firewall and proxy and connect to the http URL directly it works (even if in that case I must use the full URL to have a meaningful behavior).有一个我无法克服的握手问题,如果我禁用防火墙和代理并连接到 http URL 直接它可以工作(即使在这种情况下我必须使用完整的 ZE6B391A8D2C45903DZA 才能有有意义的行为) So my problem is purely in Indy: how to connect to that URL successfully?所以我的问题纯粹是在 Indy:如何成功连接到 URL?
This is the code i use:这是我使用的代码:
procedure TForm1.btnGetFromMyWebserver(Sender: TObject);
var
IdHTTP: TIdHTTP;
IdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
response, url: string;
begin
IdHTTP := TIdHTTP.Create;
// here i set the custom headers that are not relevant
// to study the connection closed by peer problem
try
try
IdSSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP);
IdSSLIOHandlerSocketOpenSSL.Port := 443; // I tried to force the port to 443
IdSSLIOHandlerSocketOpenSSL.SSLOptions.Mode := sslmClient;
IdSSLIOHandlerSocketOpenSSL.SSLOptions.SSLVersions:= [sslvTLSv1_2];
IdHTTP.IOHandler := IdSSLIOHandlerSocketOpenSSL;
IdHTTP.HandleRedirects := True;
url := 'https://nesufficio.my.qualibus.it/FeriePermessiDemo/DOQualibus/QappCommandHandler'; // this is not the actual endpoint but it is enough to reproduce the handshaking error
response := IdHTTP.Get(url);
except
on e:Exception
do
response := e.message;
end;
finally
IdHTTP.Free;
end;
ShowMessage('Response was:' + response);
end;
Could you please give me a hand and help me pinpoint where the problem is?你能帮我看看问题出在哪里吗?
My indy version is 10.6.2.5298
and I use Delphi 10 Seattle.我的 indy 版本是10.6.2.5298
,我使用 Delphi 10 Seattle。
Thanks in advance.提前致谢。
I realized I was using very old Open SSL dlls, by getting the latest from GitHub , as advised by Remy Lebeau I managed to make the gethttp call work properly even with a https
endpoint.我意识到我正在使用非常旧的 Open SSL dll,通过从GitHub获取最新版本,正如 Remy Lebeau 所建议的那样,即使使用https
端点,我也设法使 gethttp 调用正常工作。
So the solution is just use a recent version of the Open SSl dlls.所以解决方案就是使用 Open SSl dll 的最新版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.