It’s a sad state of affairs when Xojo’s ancient HTTP/1.0-only socket, HTTPSecureSocket, is more reliable than BOTH of Xojo’s modern HTTP classes.
At least a year ago, I tried using Xojo.Net.HTTPSocket for my Beacon project. It works as intended on Mac, but had issues on Windows. Issues such as the AuthenticationRequired event never firing, and SendProgress event not including values, made it more reliable to just use the old socket. So I wrote a wrapper that used Xojo.Net.HTTPSocket on Mac and HTTPSecureSocket on Windows.
The situation is frustrating because the socket is at the mercy of the underlying system libraries. If you need support TLS 1.1 or newer on Windows, you have to make sure a specific Windows Update is installed on the end-user computer. The install doesn’t always work and this issue is probably my single biggest support ticket item.
Xojo introduced URLConnection and as of my testing with 2019r2, looked much better, despite being still reliant on the WinHTTP library. That Windows Update is still needed though. But par for the course, the socket STILL isn’t ready for production. I just discovered that the socket disconnects and fails if a server ALLOWS a client certificate. The server doesn’t even have to require the certificate, the socket will still disconnect. Feedback case filed.
I’m so unbelievably fed up with these sockets. What we have is a cross-platform tool with a socket that is anything but cross platform. It may share the same API on each platform, but its behavior is wildly inconsistent between platforms.
When I asked why they chose not to build a cross-platform socket on a common library such as CURL, I was told they decided it was too much effort. So instead, their users get to spend all that effort. The sockets are substantially worse than they could be if they were based on CURL. Xojo’s entire purpose is to shield us from these types of cross-platform issues!
Both Xojo.Net.HTTPSocket and URLConnection are a failure. I have literally never been able to use either in production code on Windows because they have always had serious problems.
So I wrote HTTPClientSocket. The best way to describe it is URLConnection built on CURL. It should be a drop-in replacement for URLConnection, with a couple minor caveats, so read the README. It’s built on the MBS CURL plugin though, which I really dislike requiring, but I’m getting desperate.
But this is how it is. Xojo takes the lazy way out, and we suffer the consequences.
Source: Thom McGrath