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

XHRConnection does not handle binary protocols

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Node.js - Library
    • 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

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

            Dates

              Created:
              Updated: