0

I am working on a Roku Scene Graph application. It gets request data from remote servers specified by URLs. However, the response was not returning and showing an error:

SSL: no alternative certificate subject name matches target host name...

How do I make a request with an HTTPS URL while the website is insecure?

My code for request data is below:

request = CreateObject("roUrlTransfer")  
request.SetCertificatesFile("common:/certs/ca-bundle.crt")
request.AddHeader("X-Roku-Reserved-Dev-Id", "")
request.InitClientCertificates()
request.SetUrl(url)  
port = CreateObject("roMessagePort")
request.SetMessagePort(port)
request.SetPort(port)    
timer = createobject("roTimeSpan")
request.AsyncGetToString()   
while true    
    msg = wait(10, port)
    if type(msg) = "roUrlEvent" then
        if msg.GetResponseCode() = 200 then
            m.data = msg.GetString()   
            return m.data
            exit while
        else
            print msg.GetResponseCode() 
            print msg.GetFailureReason()
            exit while
        end if        
    end if      
end while

Code for download images:-

mgr = CreateObject("roTextureManager")
msgport = CreateObject("roMessagePort")
mgr.SetMessagePort(msgport)

request = CreateObject("roTextureRequest","https://192.168.1.10/ball.png")
request.SetCertificatesFile("common:/certs/ca-bundle.crt")
request.InitClientCertificates()

mgr.RequestTexture(request)
Jess Bowers
  • 2,846
  • 1
  • 22
  • 42
Balbant Singh
  • 187
  • 1
  • 10

1 Answers1

2

My recommendation is the certificate issue should be fixed on the server side.

Back to your question, you can disable SSL verification on Roku by using the method EnableHostVerification(enable as Boolean) as Boolean of the ifUrlTransfer interface.

request.EnableHostVerification(false)
Thanh Pham
  • 2,021
  • 21
  • 30