nathanjosiah
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019
05:40 PM
roURLTranfer returning response code -1 (CURLE_UNSUPPORTED_PROTOCOL)
I have this simple usage of roURLTransfer:
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?
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?
1 REPLY 1
nathanjosiah
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019
08:55 PM
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.
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.