I’m only getting weird and unexpected results these days…
After installing php for apache on my server (the module which executes php URLs rather than showing the code on screen), I was going to try it, with an URL such as this:
Using Safari, it works fine; I get a 0 printed on the page.
With Xojo, I tested in a blank project:
I’m getting an Error: NSURLErrorDomain error -1012.
This error is described like this: NSURLErrorUserCancelledAuthentication.
I’ve put a Break statement in the AuthenticationRequested event, but it’s never called. I don’t quite understand how the authentication would have been cancelled if the event isn’t even called.
As usual, the issues I get don’t find an answer with Google.
BTW: Yesterday, calling these URLs made 301 error code (permanent redirection) where the destination of the redirection was the same as the asked URL. Weird and not explainable…
I’ve also checked the server’s error logs and got no answer there (possibly overlooked?).
Any idea, please?
It would be interesting to know if any other information was transmitted back with the 301 status code. That might tell us what the problem is.
As far as the error goes, you might want to try your code on Windows and Linux just to see if the errors are similar.
Just out of curiosity, is the server requesting authentication when you connect with a browser?
Here’s what the full message is (just edited to shorten the URLs):
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">�<html><head>�<title>301 Moved Permanently</title>�</head><body>�<h1>Moved Permanently</h1>�<p>The document has moved <a href="https://www.[…].php?DNR=1">here</a>.</p>�<hr>�<address>Apache/2.4.41 (Ubuntu) Server at www.[myserver] Port 80</address>�</body></html>�
I’ve not yet managed to install Xojo on Windows or set the Remote Debugger up. I’ll try as soon as possible.
I tried with Firefox on Windows 10.
It first reports me a doubt about the certificate (MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT). I also had it with Safari but just accepted the certificate (so I assume the acceptance of the certificate is system wide and included to my Xojo apps). And then the page worked.
Aha! So the socket won’t let you connect to those unless you set AllowCertificateValidation to False. It’s trying to protect you from connecting to a non-valid server.
Ok, good guess. But when I set AllowCertificateValidation to False, another error is encountered: -1200 (can’t establish a secure connection to the server).
What to do now?
It sounds like the server also doesn’t support newer security protocols.
My suggestion is to add a real certificate to the server if at all possible.
That’s strange. I’ve just (re)installed it one week ago, with Ubuntu 20. Surely it should support them…
I have to admit, I followed tutorials to add this certificate. All tutorials I recall having read mentioned the same approach with self-signed certificates (that’s why I didn’t even thought it could be a mistake).
Perhaps I don’t mind installing such a certificate; what are alternatives for my server to send back results from php scripts?
I could have a web app listening on my server and handling requests that were done previously as php scripts. Would that be overkill (read: use way too much resources than needed)? Has someone already done so and it’s ok?