From 6074db4a74121e11e4f39c8d258bf722286b39db Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 6 Mar 2008 18:12:38 +0000 Subject: [PATCH] deal with blank api command replies in es git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7803 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 42e7a1ad86..34988c8b20 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -604,7 +604,12 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t * thread, void *obj) } else { switch_size_t rlen, blen; char buf[1024] = ""; - rlen = strlen(reply); + + if (!(rlen = strlen(reply))) { + reply = "-ERR no reply\n"; + rlen = strlen(reply); + } + switch_snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", rlen); blen = strlen(buf); switch_socket_send(acs->listener->sock, buf, &blen);