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

node: TJSONProtocol parse error when reading from buffered message

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.9.2
    • Component/s: Node.js - Library
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: