我正在研究Roku Scene Graph应用程序。它从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)
答案 0 :(得分:1)
我的建议是证书问题应该在服务器端修复。
回到您的问题,您可以使用the method EnableHostVerification(enable as Boolean) as Boolean
of the ifUrlTransfer
interface停用Roku上的SSL验证。
request.EnableHostVerification(false)