(09-16-2020, 04:11 PM)ronaldobim Wrote: I am unable to consume a third party API that is hosted on Amazon, I tried several OpenSSL DLLs but without success.
Which DLLs exactly did you try? What does Indy's
IdSSLOpenSSL.OpenSSLVersion() function report when the error occurs?
(09-16-2020, 04:11 PM)ronaldobim Wrote: I am attaching a small test project with the error example.
You are not configuring the
TIdSSLIOHandlerSocketOpenSSL at all. In particular, it defaults to TLS 1.0 only, but most servers nowadays require TLS 1.1+, so try setting its
SSLOptions.SSLVersions property accordingly, eg:
Code:
FHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
FIdHTTP.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; // <-- ADD THIS!
...
Also, you are leaking the
TIdSSLIOHandlerSocketOpenSSL object, as you are not
Free()'ing it, or assigning an
Owner to it. Assigning the
TIdHTTP.IOHandler property will not take ownership for you. I suggest assigning the
TIdHTTP object as the
Owner, eg:
Code:
FIdHTTP := TIdHTTP.Create(nil); // <-- DO THIS FIRST!
FHandler := TIdSSLIOHandlerSocketOpenSSL.Create(FIdHTTP);
Also, on a side note, you don't need the
TStringStream at all, as
TIdHTTP.Get() has an overload that returns a
String, eg:
Code:
Memo1.Text := FIdHTTP.Get('https://james-assortment-orders-stg.james.delivery/orders/consume-pre-orders/0583266930008a57838f5141aae0ea5138ec43aebd5465465');