[sr-dev] git:master:bbacab49: jsonrpc_s: Return an error when JSON parsing fails
Alex Hermann
alex at speakup.nl
Tue Aug 30 13:51:41 CEST 2016
Module: kamailio
Branch: master
Commit: bbacab495841ef270f98b743352ad8aca9649b47
URL: https://github.com/kamailio/kamailio/commit/bbacab495841ef270f98b743352ad8aca9649b47
Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date: 2016-08-02T12:48:05+02:00
jsonrpc_s: Return an error when JSON parsing fails
---
Modified: modules/jsonrpc-s/jsonrpc-s_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/bbacab495841ef270f98b743352ad8aca9649b47.diff
Patch: https://github.com/kamailio/kamailio/commit/bbacab495841ef270f98b743352ad8aca9649b47.patch
---
diff --git a/modules/jsonrpc-s/jsonrpc-s_mod.c b/modules/jsonrpc-s/jsonrpc-s_mod.c
index 62f2506..9c0fc72 100644
--- a/modules/jsonrpc-s/jsonrpc-s_mod.c
+++ b/modules/jsonrpc-s/jsonrpc-s_mod.c
@@ -571,7 +571,7 @@ static int jsonrpc_scan(jsonrpc_ctx_t* ctx, char* fmt, ...)
case '{':
case '[':
LM_ERR("Unsupported param type '%c'\n", *fmt);
- jsonrpc_fault(ctx, 500, "Unsupported param type");
+ jsonrpc_fault(ctx, 400, "Unsupported param type");
goto error;
default:
LM_ERR("Invalid param type in formatting string: [%c]\n", *fmt);
@@ -1041,7 +1041,7 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, char* s2)
ctx->jreq = srjson_NewDoc(NULL);
if(ctx->jreq==NULL) {
LM_ERR("Failed to init the json document\n");
- return NONSIP_MSG_PASS;
+ return NONSIP_MSG_ERROR;
}
ctx->jreq->buf.s = get_body(msg);
@@ -1050,7 +1050,7 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, char* s2)
if(ctx->jreq->root == NULL)
{
LM_ERR("invalid json doc [[%s]]\n", ctx->jreq->buf.s);
- return NONSIP_MSG_PASS;
+ return NONSIP_MSG_ERROR;
}
if (jsonrpc_init_reply(ctx) < 0) goto send_reply;
More information about the sr-dev
mailing list