Juha Heinanen writes:

> using tcp transport, ngrep shows this:
> 
> #######
> T 2014/05/23 08:30:29.796710 127.0.0.1:59182 -> 127.0.0.1:7080 [AP]
> {"jsonrpc":"2.0","method":"calls","id":"1394e7c6-18ec-442a-90a6-39cb7eaa8c14"}
> 
> the query looks ok to me.  sems seems to be expecting to read a "size"
> containing decimal digits and does not like it, when it receives json
> request starting with '{'.
> 
> what is this "size" that sems wants to get?  where is it specified?

after some amount of ducking i found that sems implements json 2.0 over
tcp using netstrings, i.e., each request and response is of form
<size>:<json request or response>, where <size> is number of bytes in
<json request or response>.

i then went and made the test using a json-rpc client that uses
netstrings.  here is the result:

##
T 2014/05/24 16:39:36.106448 127.0.0.1:33836 -> 127.0.0.1:7080 [AP]
66:{"params": {}, "jsonrpc": "2.0", "method": "core.calls", "id": 10},
#
T 2014/05/24 16:39:36.116640 127.0.0.1:7080 -> 127.0.0.1:33836 [AP]
58:{"error": null, "id": "", "jsonrpc": "2.0", "result": [4]},
##

my understanding from json 2.0 spec is that the above response is not
correct:

    5 Response object

    When a rpc call is made, the Server MUST reply with a Response, except
    for in the case of Notifications. The Response is expressed as a single
    JSON Object, with the following members:

    jsonrpc

    A String specifying the version of the JSON-RPC protocol. MUST be
    exactly "2.0". 

    result

    This member is REQUIRED on success.  This member MUST NOT exist if there
    was an error invoking the method.  The value of this member is
    determined by the method invoked on the Server.

    error

    This member is REQUIRED on error.  This member MUST NOT exist if there
    was no error triggered during invocation.  The value for this member
    MUST be an Object as defined in section 5.1.

    id

    This member is REQUIRED.

    It MUST be the same as the value of the id member in the Request Object.    
    If there was an error in detecting the id in the Request object
    (e.g. Parse error/Invalid Request), it MUST be Null.

    Either the result member or error member MUST be included, but both
    members MUST NOT be included.
        
based on this, there exists two bugs in the response:

1) both error and result are included

2) id value is empty string

-- juha
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to