Forum Discussion

scottchiefbaker's avatar
13 years ago

Fetch XML via HTTPS

I want to use HTTPS to fetch my XML files, but simply putting https in the URL isn't enough. After reading the documentation I think maybe I need to use SetCertificatesFile() to give it some key? The key of the CA? Do I need to bundle the cert with my app, or can I pass it a URL to get the cert?

url = "https://www.perturb.org/hls/test.xml"
http = NewHttp(url)
http.SetCertificatesFile(???)
rsp = http.GetToStringWithRetry()

3 Replies

  • In most cases, you can just use the built in cert bundle.

    xfer.SetCertificatesFile("common:/certs/ca-bundle.crt")


    http://sdkdocs.roku.com/display/RokuSDK ... rlTransfer

    The URL Transfer object authenticates your web server by calling SetCertificatesFile()with a .pem file that includes the certificate authority cert for the authority (like Verisign, Thawte, etc… or your own with OpenSSL) that signed your web server certificate before making the https request. You can use the Roku standard cert bundle (similar to Mozilla) stored in common:/certs/ca-bundle.crt
  • I'm trying to set it, and I'm getting a function not found?

    url = "https://www.perturb.org/hls/test.xml"
    http = NewHttp(url)
    http.SetCertificatesFile("common:/certs/ca-bundle.crt")
    http.InitClientCertificates()


    Member function not found in BrightScript Component or interface. (runtime error &hf4) in .../pkg:/source/categoryFeed.brs(65)

    065: http.SetCertificatesFile("common:/certs/ca-bundle.crt")
  • Disregard... I didn't realize the roUrlTransfer object was http.Http. Once I set that, it works fine. My HTTPS is working, thanks!