UPDATE: i did change HttpUtils2Service, it's seems to work, You should test anyway
I attach my OkHttpUtils2 (vers 2.83) in this post
Put it in the internal folder, replacing the old one (but remember to mantain this code with any new installation of B4A)
In HttpUtils2Service,bas i added
Code:
Public AcceptAllSSLCertificates As Boolean = False
And in Service_Create I changed the folowing
Code:
Select AcceptAllSSLCertificates
Case False
hc.Initialize("hc")
Case True
hc.InitializeAcceptAll("hc")
End Select
Then whenever you need to send a request, just befor this line set in code
Code:
HttpUtils2Service.AcceptAllSSLCertificates = True
So the old code below will be..
This is a common error regarding using self signed certification on my NAS.
I was trying to execute the following code
Code:
Dim Job As HttpJob
'Job.InitializeAcceptAll("",Me)
Job.Initialize("", Me)'
Job.Username =""
Job.Password=""
HttpUtils2Service.AcceptAllSSLCertificates=True 'addition here
Job.Download($"${NEW_APK_Location}/version.txt"$)
Wait For (Job) JobDone(Job As HttpJob)
If Job.Success Then
Log($"Dwnl success ${Job.GetString}"$)
Else
Log($"Err down ${Job.ErrorMessage}"$)
End If
Job.Release
The solution is to edit the source code found here
https://www.b4x.com/android/forum/threads/b4x-okhttputils2-ihttputils2-httputils2-source-code.82632/ (vers 2.70 - internal one 2.82) and integrate "InitializeAcceptAll" as instructed here
https://www.b4x.com/android/forum/t...-using-self-signed-openssl.76268/#post-483974
This is a wish (not because I am lazzy) but because the internal version is newer (and always will be)
I could modify by myself, then compile into library and replace, but this will be a repetitive task with each new release.
Sugestion, please
@Erel /another staff member, put a new method in this module, keep "Initialize" and put "Initialize2" whatever to support self signed certificates.
Thanks.