iOS Question http and authentication error

moster67

Expert
Licensed User
Longtime User
I have used the http-example project and used it to try to connect to a set-top box receiver (STB) which has its own web-server. As long as I disable authentication, I can connect fine and log returned information using the GetString-method. However with authentication, I get authentication error 401. Needless to say, the STB works fine with Android.

I also tried using SSL (https) but also this does not work (for SSL I enabled of course hc.InitializeAcceptAll("hc") in the initialize-sub in the HttpUtils2Service-module).

The error message I get is:

B4X:
Application_Start
Application_Active
Error response: , status code: 401
[_success=0, _jobname=j, _username=root
, _password=Test, _errormessage=The operation couldn’t be completed. (NSURLErrorDomain error -1013.), _target=<b4i_main: (null)>
, _req=<B4IHttpRequest: <NSMutableURLRequest: 0x17e98c50> { URL: http://192.168.1.5 }>, _tag=<NSObject: 0x17e99200>, _res=(null)
, _main=<b4i_main: (null)>, _httputils2service=<b4i_httputils2service: (null)>]

The server is using Basic Authentication (I will test later on a different STB which is running a different web-server implementing Digest Access Authentication but for now and in this case, it is not relevant). Just as a test, I tried to connect using the old syntax: h*ttp://root:[email protected] but it would not work.

I googled for NSURLErrorDomain error -1013 but there is hardly no information about it, not even on StackOverFlow :(. It seems to be undocumented.

I haven't had time yet to use a network-sniffer to see the exchange of information but perhaps above error message is enough to track down the error.

Using Safari on the device, I can connect to the STB using authentication just fine.
 

moster67

Expert
Licensed User
Longtime User
Now it works! Thank you.

I also checked SSL (https) on port 443 and it also works.
 
Upvote 0
Top