URLConnection errors without reason on Windows 7

I have a customer with a problem I can’t make sense of. Being that it’s URLConnection on Windows, that’s not surprising, but nevertheless I’m trying to figure out what could be causing this.

My app connects primarily to two servers: api.beaconapp.cc is a server I control, and api.nitrado.net is the server for a hosting provider. The user is able to connect to my server, but not to Nitrado’s server. No message is provided in the exception provided by URLConnection, and the http status is 0. I theorized that root certificates were to blame, but we managed to rule that out as they’re correct on the user’s system.

I can’t wrap my head around what could cause this on one server by not another. I suspect it is similar or directly related to <https://xojo.com/issue/57949> as Nitrado’s server is the same one I discovered that issue on.

buffer overflows may cause the error code to be reset to 0. So it could be that the user has not enough memory avail.
edit; on window 7-10

[quote=496389:@Derk Jochems]buffer overflows may cause the error code to be reset to 0. So it could be that the user has not enough memory avail.
edit; on window 7-10[/quote]
I think that’s unlikely in this scenario. It would be incredible if the response to this request even touched 1MB. It’s a GET request too, so not even a body in the request.

The most likely scenario is simply some issue is resetting the error code or Xojo bugged it internally. The only thing that i know of can cause error code 0 is it not even being set, or the actual code is being “reset” by something.

That is ofcourse if this uses winsock internally:
https://docs.microsoft.com/nl-nl/windows/win32/api/winsock/nf-winsock-wsagetlasterror

To rule out a network or server problem, can you (or your customer) simulate the connection using a browser? This could give you a better error message. Also might need to disable “friendly messages” in the browser settings to see whats actually happening.

Browsers don’t count because they don’t go through WinHTTP. The browser makers have learned not to rely on it.

FWIW

URLConnection is leaking. <https://xojo.com/issue/59628>

Seems unstable: <https://xojo.com/issue/59060>

Also read this for Windows 7 users, as they could need an update: Update to enable TLS 1.1 and TLS 1.2 as default secure protocols in WinHTTP in Windows

[quote=496432:@Rick Araujo]FWIW

URLConnection is leaking. <https://xojo.com/issue/59628>

Seems unstable: <https://xojo.com/issue/59060>

Also read this for Windows 7 users, as they could need an update: https://support.microsoft.com/en-gb/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-windows[/quote]
All reasons Xojo should have used curl, but choose the easy route instead of the good route.

Yep. Their “R&D department” should spend a time on libcurl, and we could get many protocols as extra side benefits.

You can use my libcurl wrapper library for Xojo. It’s free and open source and doesn’t require any IDE plugins.

https://github.com/charonn0/RB-libcURL

[quote=496622:@Andrew Lambert]You can use my libcurl wrapper library for Xojo. It’s free and open source and doesn’t require any IDE plugins.

https://github.com/charonn0/RB-libcURL[/quote]
That’s a nice module. It’s definitely something I’m going to consider.

I really wish MBS had an event-driven version of CURLSMBS.

Could this be antivirus software? If you test the URL in a browser, you might discover if that’s a problem.

That’s my suspicion, but browsers aren’t a good test because they don’t use WinHTTP.