Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4145

XHRConnection does not handle binary protocols

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Node.js - Library
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hakon HÃ¥kon Hitland
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: