I want to download the JSON Info at
idHTTP := TIdHTTP.Create(nil);
JSON:=idHTTP.get('https://login.microsoftonline.com/common/.well-known/openid-configuration');
and get an error
10054 Connection reset by peer
. Downloading in the browser works.
How can I go about finding the issue?
10054 means the TCP connection is being reset abruptly on the remote end.
You are trying to download from an encrypted HTTPS url, so you need to assign a TIdSSLIOHandlerSocketBase
-derived component (such as TIdSSLIOHandlerSocketOpenSSL
) to the TIdHTTP.IOHandler
property. But, you don't appear to be doing that.
If you are using an up-to-date version of Indy, TIdHTTP
raises an EIdIOHandlerPropInvalid
exception if an SSLIOHandler
is not assigned when requesting an HTTPS url. But, if you are using an older version of Indy (which you did not indicate) that is not doing that check, then it is possible that TIdHTTP
is creating the TCP connection and then the server resets the connection immediately when it doesn't receive a TLS handshake.
If you are using an up-to-date version of Indy, you can add the IdSSLOpenSSL
unit in your uses
clause and TIdHTTP
will create a default TIdSSLIOHandlerSocketOpenSSL
instance for you when needed, but just note that it will have only TLS 1.0 enabled on it, so if you need to use TLS 1.1+ instead then you will have to create the TIdSSLIOHandlerSocketOpenSSL
object yourself and configure it as needed.