Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
nathanjosiah
Visitor

roURLTranfer returning response code -1 (CURLE_UNSUPPORTED_PROTOCOL)

I have this simple usage of roURLTransfer:

    xfer = CreateObject("roURLTransfer")
    xfer.SetPort(port)
   xfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
    xfer.SetURL(url)
   if xfer.AsyncGetToString()
       event = wait(timeout, port)
       if type(event) = "roUrlEvent"
           m.responseCode = event.GetResponseCode()
           print "request took: " + timer.TotalMilliseconds().ToStr()
           print "response code: " + m.responseCode.ToStr()
           result = event.GetString()
       endif
   end if


The URL is an https:// URL and works fine in browser and other tools. On roku, the response code is always -1, the request only takes about 200ms, and the response is always blank. According to the documentation https://developer.roku.com/docs/references/brightscript/events/rourlevent.md#getresponsecode-as-inte... the code means that cURL doesn't support the protocol. I don't understand this at all. Can somebody please advise?
0 Kudos
1 REPLY 1
nathanjosiah
Visitor

Re: roURLTranfer returning response code -1 (CURLE_UNSUPPORTED_PROTOCOL)

Update: After many many hours of debugging and wishing that I hadn't accepted this project, I determined that this is a bug with Brightscript or Roku SDK or Roku's implementation of cUrl. 

Hard to say the exact cause but the way fixed it is that I noticed that even though the content-type header specified utf-8 and the xml charset was utf-8, the HTTP responses for some reason had a BOM marker (specifically UTF-8's xEF xBB xBF). After removing that all the requests started processing correctly. 

This is a very frustrating bug as the error reported is incorrect and further information is not available.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.