diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2018-08-01 13:44:23 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-08-02 15:49:43 +0200 |
commit | e39610f8c9b2e6bbb8a460f7d7ccccbc5161b4ed (patch) | |
tree | 9f11498d5ba8793c925a4b1a36591dfdc736adbb /src/main-afb-daemon.c | |
parent | 10aa15afc5bc7321d0049823dd173dda11ff3724 (diff) |
Improve parsing of json string
Change-Id: I7100961ef8f8a75d623a0667178f191dd4cfb9d3
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/main-afb-daemon.c')
-rw-r--r-- | src/main-afb-daemon.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main-afb-daemon.c b/src/main-afb-daemon.c index f1996811..df0efbcc 100644 --- a/src/main-afb-daemon.c +++ b/src/main-afb-daemon.c @@ -552,6 +552,7 @@ static struct afb_xreq_query_itf startup_xreq_itf = static void startup_call_current(struct startup_req *sreq) { const char *api, *verb, *json; + enum json_tokener_error jerr; sreq->callspec = json_object_get_string(json_object_array_get_idx(sreq->calls, sreq->index)), api = sreq->callspec; @@ -566,8 +567,8 @@ static void startup_call_current(struct startup_req *sreq) sreq->verb = strndup(verb + 1, json - verb - 1); sreq->xreq.request.called_api = sreq->api; sreq->xreq.request.called_verb = sreq->verb; - sreq->xreq.json = json_tokener_parse(json + 1); - if (sreq->api && sreq->verb && sreq->xreq.json) { + sreq->xreq.json = json_tokener_parse_verbose(json + 1, &jerr); + if (sreq->api && sreq->verb && jerr == json_tokener_success) { afb_xreq_process(&sreq->xreq, main_apiset); return; } |