【问题标题】:How to handle a request with HTTPS protocol in Roku SG while website insecure?当网站不安全时,如何在 Roku SG 中使用 HTTPS 协议处理请求?
【发布时间】:2018-02-03 05:31:58
【问题描述】:

我正在开发 Roku 场景图应用程序。它从 URL 指定的远程服务器获取请求数据。但是,响应没有返回并显示错误:

SSL:没有替代证书主题名称与目标主机名匹配...

当网站不安全时,如何使用 HTTPS URL 发出请求?

我的请求数据代码如下:

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

图片下载代码:-

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)

【问题讨论】:

  • 您是否为 ssl 相互认证配置了 Web 服务器?

标签: roku brightscript scenegraph


【解决方案1】:

我的建议是证书问题应该在服务器端修复。

回到您的问题,您可以使用 the method EnableHostVerification(enable as Boolean) as Boolean of the ifUrlTransfer interface 禁用 Roku 上的 SSL 验证。

request.EnableHostVerification(false)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-27
    • 1970-01-01
    • 2016-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多