Håkon Hitland created THRIFT-4145:
-------------------------------------
Summary: XHRConnection does not handle binary protocols
Key: THRIFT-4145
URL: https://issues.apache.org/jira/browse/THRIFT-4145
Project: Thrift
Issue Type: Bug
Components: Node.js - Library
Reporter: Håkon Hitland
Trying to use the binary protocol with XHRConnection results in a "Bad version
in readMessageBegin" error message.
It looks like the response body undergoes a ISO-8859-to-UTF8 conversion before
being parsed as bytes.
There is already code for handling ArrayBuffers, but I don't see a way to
trigger it.
It seems to work with two changes:
- set xreq.responseType = 'arraybuffer' somewhere in
XHRConnection.prototype.flush
- call "self.setRecvBuffer(this.response);" instead of
"self.setRecvBuffer(this.responseText);" in the callabck.
I have not tested how this affects the JSONProtocol. If it has to use text,
maybe each protocol should provide their media type as defined in THRIFT-3250
so XHRConnection can use the right content type and do any required special
case.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)