[ 
https://issues.apache.org/jira/browse/THRIFT-829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892993#action_12892993
 ] 

Roger Meier commented on THRIFT-829:
------------------------------------

Hi Jordan

my assumtion is, that the eval function (load json response from thrift server 
into an object) on line 464 ([thrift.js | 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/js/thrift.js?view=markup])
 and rstack approach goes into the wrong direction.
{code}
    // Reading functions
    readMessageBegin : function(name, messageType, seqid){
        this.rstack = new Array()
        this.rpos   = new Array()
       
        this.robj = eval(this.transport.readAll())
        
        var r = {}     
        var version = this.robj.shift()
        
        if(version != Thrift.Protocol.Version){
            throw "Wrong thrift protocol version: "+version
        }

        r["fname"]  = this.robj.shift()
        r["mtype"]  = this.robj.shift()
        r["rseqid"] = this.robj.shift()
        
        
        //get to the main obj
        this.rstack.push(this.robj.shift())
      
        return r
    },
{code}

I propose reimplementing the JSON protocol by doing manual parsing as on other 
Implementations.

The C++ 
[TJSONProtocol.cpp|http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/protocol/TJSONProtocol.cpp?view=markup]
 might be a good starting point for that. A Binary Protocol implementation can 
be done in the same way in a later step.

I think the javascript compiler is heavily inspired by the cpp version and does 
the right thing, the real issue are coming from thrift.js and the Javascript 
eval() approach.




> Need assistance in getting ramped up on code base. 
> ---------------------------------------------------
>
>                 Key: THRIFT-829
>                 URL: https://issues.apache.org/jira/browse/THRIFT-829
>             Project: Thrift
>          Issue Type: Question
>          Components: Compiler (JavaScript)
>            Reporter: Jordan
>
> So, it seems like getting the TJSONProtocol parsing on the client is kind of 
> tricky. 
> In the long term, I'd love to help, and if someone is available to meet on 
> the phone, in order to go over some of the code base, including thrift.js, 
> TJSONProtocol, please let me know. I'm available every day to chat. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to