0

I understand the problem was discussed lot of times. I have made lot of projects with Indy and http/https.

In actual project second side gave me api endpoint secured with ssl.

I think I can publish it with demo credentials.

https://portal.myraindancer.com/api/v1/crops?client=150002&username=demo&password=demo

After 2 hours I have to give up and I suspect the problem is at the api side.

I always get exception with

#10054: Connection reset by peer.

Could you help me to show correct way to get data?

I use browser with the URL and can get data without any problem.

Code snippet (pls note I used all possible ssl methods):

procedure TForm2.Button1Click(Sender: TObject);
var
  sHttpSocket: TIdHTTP;
  sshSocketHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
  sHttpSocket := TIdHTTP.Create;
  try
    sshSocketHandler := TIdSSLIOHandlerSocketOpenSSL.Create(sHttpSocket);
    sshSocketHandler.SSLOptions.Method := sslvSSLv23;
    sHttpSocket.IOHandler := sshSocketHandler;
    sHttpSocket.Get('https://portal.myraindancer.com/api/v1/crops?client=150002&username=demo&password=demo');
  finally
    sHttpSocket.Free;
  end;
end;

UPDATE: Delphi XE7, Win32 project, Indy 10.6.2.0

UPDATE 2: The problem occured after I updatd Indy to last version. But I forgot to correct library path in project options. Solved. I think it would be better to close the post.

mad
  • 1,029
  • 3
  • 17
  • 38
  • @whosrdaddy I would be real glad :) But it does not work with the same error. – mad Jul 25 '18 at 10:54
  • what OpenSSL dll's are you using? – whosrdaddy Jul 25 '18 at 10:57
  • 2
    The problem is that the server requires SNI and your client probably does not provide it. You might check with `openssl s_client -connect portal.myraindancer.com:443` (no SNI - causes reset) vs. `openssl s_client -connect portal.myraindancer.com:443 -servername portal.myraindancer.com` (with SNI, success). – Steffen Ullrich Jul 25 '18 at 10:59

0 Answers0