提交 f55f15c8 authored 作者: Seven Du's avatar Seven Du

accept binary in api and bgapi

上级 253e74d6
...@@ -634,7 +634,7 @@ static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, in ...@@ -634,7 +634,7 @@ static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, in
ei_get_type(buf->buff, &buf->index, &type, &size); ei_get_type(buf->buff, &buf->index, &type, &size);
arg = malloc(size + 1); arg = malloc(size + 1);
if (ei_decode_string(buf->buff, &buf->index, arg)) { if (ei_decode_string_or_binary(buf->buff, &buf->index, size, arg)) {
fail = SWITCH_TRUE; fail = SWITCH_TRUE;
} }
...@@ -664,7 +664,7 @@ static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg * msg, ...@@ -664,7 +664,7 @@ static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg * msg,
{ {
char api_cmd[MAXATOMLEN]; char api_cmd[MAXATOMLEN];
char arg[1024]; char arg[1024];
if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string(buf->buff, &buf->index, arg)) { if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string_or_binary(buf->buff, &buf->index, 1023, arg)) {
ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_tuple_header(rbuf, 2);
ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "error");
ei_x_encode_atom(rbuf, "badarg"); ei_x_encode_atom(rbuf, "badarg");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论