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

node: TJSONProtocol parse error when reading from buffered message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.2
    • 0.9.2
    • Node.js - Library
    • None

    Description

      Hello,

      The current implementation of TJSONProtocol in node uses JSON.parse(this.trans.readAll()) to deserialize, it is working with TFramedTransport because readAll, returns a sole message, but when using TBufferedTransport several messages can be contained in the buffer. This cause a parse error from JSON.parse because it starts to read the next message as if it belongs to the first

      I think the solution is to either to:

      • detect the end of the JSON and parse only the message chunck
      • implement/use a JSON parse wich can use data stream (like its done in the other languages)

      Best regards,

      Pierre

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chubinou Pierre Lamot
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: