network.request and ssl problem!

when i made a request using network.request to a https server, on android 8 or IOS it work flawless.

if i use the same code to same https server in a android 4.4 device it will fail and return error. I don’t have android 5, 6, 7 devices to tell if any other versions are affected by this.

I saw in old posts that it seams to be related to certifcates, but in this case, why it works in modern android version and not in old? the problem is in android or corona code?

i had to change my code to detect what device it is…and force http:// if its a old android.

the problem is i’ve some webviews calling websites that i can’t control, even if i call as http…the sever redirects to https website so i can’t do nothing about it and will give me an error when using webviews.

*edit* - i’ve same problem downloading images from same server, i tried to call in http:// but it will try to download the file in https:// anyway…so it will not download any file at all.

if it’s a certificate problem what can i do to tell the website owner to do? in my browser it says the certificate is ok and shows  secured connection.

If it’s not, it’s a Android problem or Corona problem?

with a little bit of more testing. i found out that maybe it could be a samsung device problem.

in the same device if I go to the https website with samsung default browser it will give me ssl certificate error. same when i call a webview inside the app, so it seams my network.request and my webviews are using same code as samsung browser. webview i understand that is just calling the browser in a window. if in the same device i open the website in Chrome, it will open flawless without any error.

i tried multiple approaches to resolve the problem, auto date, clean cache, etc…even factory reset the device…guess what? didn’t work any.

if anyone had similar problems with ssl certificates please share with me how to try to resolve this. My client have a samsung s4 with android 4.4 and he can’t access his app and I don’t know how to resolve it. The only phone i was able to replicate the problem was an older Samsung with android 4.2.

if anyone wants to help and if you have a samsung device, please let me know. i will send you the website with a private msg so you can test it on your device.

i was able to download from the same https that gave me ssl error, json files and images.

i didn’t use network.request

i used LuaSocket.

the code that i was able to retrieve images from the https server was this:

local openssl = require('plugin.openssl') local ltn12 = require('ltn12') local plugin\_luasec\_https = require('plugin\_luasec\_https') local filename="image.jpg" local url = "https://coronalabs.com/wordpress/wp-content/uploads/2017/06/hp\_laptop2.png" -- changed original address but you can test with this one local outfile = system.pathForFile(filename, system.TemporaryDirectory) local outfilePtr = io.open(outfile, 'wb') print("Requesting secure URL on HTTPS socket: " .. url) plugin\_luasec\_https.request({ url = url, sink = ltn12.sink.file(outfilePtr), protocol = "any" }) local image=display.newImageRect(filename, system.TemporaryDirectory, 700\*.25, 466\*.25) image:translate(display.contentWidth\*.5, display.contentHeight\*.5)

the only problem is this code is that is not asynchronous. I need asynchronous calls my images are going to a tableview they are created while someone is scrolling. it’s possible to create asynchronous calls with luasockets? if so any light? just started today with luasockets to see if i can resolve the problem.

my other question is, if i’m manage to download with luasockets why network.request doesn’t work. I’m starting to think that corona code have something to blame here also.

with a little bit of more testing. i found out that maybe it could be a samsung device problem.

in the same device if I go to the https website with samsung default browser it will give me ssl certificate error. same when i call a webview inside the app, so it seams my network.request and my webviews are using same code as samsung browser. webview i understand that is just calling the browser in a window. if in the same device i open the website in Chrome, it will open flawless without any error.

i tried multiple approaches to resolve the problem, auto date, clean cache, etc…even factory reset the device…guess what? didn’t work any.

if anyone had similar problems with ssl certificates please share with me how to try to resolve this. My client have a samsung s4 with android 4.4 and he can’t access his app and I don’t know how to resolve it. The only phone i was able to replicate the problem was an older Samsung with android 4.2.

if anyone wants to help and if you have a samsung device, please let me know. i will send you the website with a private msg so you can test it on your device.

i was able to download from the same https that gave me ssl error, json files and images.

i didn’t use network.request

i used LuaSocket.

the code that i was able to retrieve images from the https server was this:

local openssl = require('plugin.openssl') local ltn12 = require('ltn12') local plugin\_luasec\_https = require('plugin\_luasec\_https') local filename="image.jpg" local url = "https://coronalabs.com/wordpress/wp-content/uploads/2017/06/hp\_laptop2.png" -- changed original address but you can test with this one local outfile = system.pathForFile(filename, system.TemporaryDirectory) local outfilePtr = io.open(outfile, 'wb') print("Requesting secure URL on HTTPS socket: " .. url) plugin\_luasec\_https.request({ url = url, sink = ltn12.sink.file(outfilePtr), protocol = "any" }) local image=display.newImageRect(filename, system.TemporaryDirectory, 700\*.25, 466\*.25) image:translate(display.contentWidth\*.5, display.contentHeight\*.5)

the only problem is this code is that is not asynchronous. I need asynchronous calls my images are going to a tableview they are created while someone is scrolling. it’s possible to create asynchronous calls with luasockets? if so any light? just started today with luasockets to see if i can resolve the problem.

my other question is, if i’m manage to download with luasockets why network.request doesn’t work. I’m starting to think that corona code have something to blame here also.