Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
balbant
Level 9

How to handle a request with HTTPS protocol in Roku SG while website insecure?

I am working for Roku Scene Graph application, get request data from remote servers specified by URLs but response was not getting and getting error is "SSL: no alternative certificate subject name matches target host name...". How to request with HTTPS URL while website 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)
0 Kudos
4 REPLIES 4
tim_beynart
Level 8

Re: How to handle a request with HTTPS protocol in Roku SG while website insecure?

    try adding this:

request.enablehostverification(false)
request.enablepeerverification(false)
0 Kudos
balbant
Level 9

Re: How to handle a request with HTTPS protocol in Roku SG while website insecure?

Thank you 🙂 @tim_beynart,
Added your code then  request data (roUrlTransfer) method working fine, but still download images method is not working. please suggest.

https://forums.roku.com/memberlist.php?mode=viewprofile&u=126532 
0 Kudos
tim_beynart
Level 8

Re: How to handle a request with HTTPS protocol in Roku SG while website insecure?

I have never used roTextureRequest, so I can't help you there, sorry! Good luck
0 Kudos
destruk
Level 10

Re: How to handle a request with HTTPS protocol in Roku SG while website insecure?

Would it make more sense to change the requests to http, or to install a self-signed certificate to use HTTPS?  As it's a 192 address it ought to be ok to do either on your development network.
0 Kudos