Roku Developer Program

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

roURLTranfer returning response code -1 (CURLE_UNSUPPORTED_PROTOCOL)

I have this simple usage of roURLTransfer:

    xfer = CreateObject("roURLTransfer")
   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()
   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 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\
Level 7

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