deal with blank api command replies in es

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7803 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-03-06 18:12:38 +00:00
parent 962f1f04d5
commit 6074db4a74
1 changed files with 6 additions and 1 deletions

View File

@ -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);