I tried your code, it works. I get the HTML page of the specified URL.What is your free pascal version?
The web browsers I tried (SeaMonkey + Firefox + Safari) can retrieve the url, FPC 3.04 can retrieve the url, FPC 3.2.0/3.3.1 cannot retrieve the url.
Ergo, the problem is FPC 3.2.0/3.3.1.
Did you add opensslsockets (OpenSSL) or gnutlssockets (GNU TLS) to your uses list? (https://wiki.freepascal.org/User_Changes_3.2.0#fpHTTPClient_and_fpHTTPServer_Units)
It's also important to mention your installed OpenSSL version as there were many API changes between 1.0.2 and 1.1.x. I also don't know if both are fully supported by opensslsockets.
However, I assume that if no SSL version is defined in your code it uses SSLv23_method (1.0.2) or TLS_method (1.1.x) which negotiates the highest version mutually supported by the client and the server. Thus it should work once the library is successfully loaded.
Still looks like an issue with FPC 3.2.0/3.3.1 to me.For me it looks like an issue specific to MacOS (or your setup) because here it's working fine with Free Pascal Compiler version 3.3.1-r45857 and OpenSSL Binaries Win-64 1.1.1g (http://wiki.overbyte.eu/arch/openssl-1.1.1g-win64.zip).
OpenSSLGetVersion(0)
As I wrote above, this is a macOS / Laz 2.0.10 / fcp 3.2.0 issue only;Sorry, seems I didn't paid enough attention to this.
but independant from the macOS version (tested on High Sierra and Mojave).
@Bi0T1N: I could not found the noted calls for the SSL version (may be for windows only); openSSL is part of the macOS operating system. Open macOS Terminal and type openssl and then type version. This command returns LibreSSL 2.6.5.You need to add openssl to the uses list to use the previous mentioned functions.QuoteOpenSSLGetVersion(0)
@Trev: which units must the uses clause contain?
According to the SSL Server Test (https://www.ssllabs.com/ssltest/analyze.html?d=api.1nce.com&s=2001%3a1608%3a6%3a13%3a0%3a0%3a0%3a5&latest) even OpenSSL 1.0.1l can connect.
The first post uses the link I've used. However, both support TLSv1.2 and TLSv1.3 only.According to the SSL Server Test (https://www.ssllabs.com/ssltest/analyze.html?d=api.1nce.com&s=2001%3a1608%3a6%3a13%3a0%3a0%3a0%3a5&latest) even OpenSSL 1.0.1l can connect.
wittbo's problematic website is www.ariva.de (not api.1nce.com). That website only accepts TLSv1.2 and TLSv1.3 protocols.
According to this (https://github.com/graemeg/freepascal/blob/master/packages/openssl/src/openssl.pas#L5629) it's no longer allowed to load the unversioned one but I also don't know which one is loaded then as the DLLVersions array doesn't contain any of your numbers.According to the SSL Server Test (https://www.ssllabs.com/ssltest/analyze.html?d=api.1nce.com&s=2001%3a1608%3a6%3a13%3a0%3a0%3a0%3a5&latest) even OpenSSL 1.0.1l can connect.
The SSL libraries on macOS 10.14.6 are not OpenSSL but LibreSSL. The default unversioned /usr/lib/libssl.dylib is linked to /usr/lib/libssl.35.dylib (LibreSSL v2.2.7). There's also /usr/lib/libssl.43.dylib (LibreSSL v2.5.5) and /usr/lib/libssl.44.dylib (LibreSSL v2.6.5).
My protocol tests indicate that FPC 3.2.0/3.3.1 fails to connect to websites that only accept TLSv1.2 or above whereas FPC 3.0.4 does connect to websites that only accept TLSv1.2 and above. I'm not sure how much clearer I can make it.