dont write nulls in event_socket
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3045 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a2b11dd93d
commit
4c386b1959
|
@ -327,9 +327,9 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", strlen(data));
|
snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", strlen(data));
|
||||||
len = strlen(buf) + 1;
|
len = strlen(buf);
|
||||||
switch_socket_send(listener->sock, buf, &len);
|
switch_socket_send(listener->sock, buf, &len);
|
||||||
len = strlen(data) + 1;
|
len = strlen(data);
|
||||||
switch_socket_send(listener->sock, data, &len);
|
switch_socket_send(listener->sock, data, &len);
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
@ -367,16 +367,16 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(packet) + 1;
|
len = strlen(packet);
|
||||||
|
|
||||||
snprintf(hbuf, sizeof(hbuf), "Content-Length: %"APR_SSIZE_T_FMT"\n"
|
snprintf(hbuf, sizeof(hbuf), "Content-Length: %"APR_SSIZE_T_FMT"\n"
|
||||||
"Content-Type: text/event-%s\n"
|
"Content-Type: text/event-%s\n"
|
||||||
"\n", len, etype);
|
"\n", len, etype);
|
||||||
|
|
||||||
len = strlen(hbuf) + 1;
|
len = strlen(hbuf);
|
||||||
switch_socket_send(listener->sock, hbuf, &len);
|
switch_socket_send(listener->sock, hbuf, &len);
|
||||||
|
|
||||||
len = strlen(packet) + 1;
|
len = strlen(packet);
|
||||||
switch_socket_send(listener->sock, packet, &len);
|
switch_socket_send(listener->sock, packet, &len);
|
||||||
|
|
||||||
if (xmlstr) {
|
if (xmlstr) {
|
||||||
|
@ -430,11 +430,11 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
|
||||||
} else {
|
} else {
|
||||||
switch_size_t len;
|
switch_size_t len;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
len = strlen(stream.data) + 1;
|
len = strlen(stream.data);
|
||||||
snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", len);
|
snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %"APR_SSIZE_T_FMT"\n\n", len);
|
||||||
len = strlen(buf) + 1;
|
len = strlen(buf);
|
||||||
switch_socket_send(acs->listener->sock, buf, &len);
|
switch_socket_send(acs->listener->sock, buf, &len);
|
||||||
len = strlen(stream.data) + 1;
|
len = strlen(stream.data);
|
||||||
switch_socket_send(acs->listener->sock, stream.data, &len);
|
switch_socket_send(acs->listener->sock, stream.data, &len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
|
snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
|
||||||
|
|
||||||
len = strlen(buf) + 1;
|
len = strlen(buf);
|
||||||
switch_socket_send(listener->sock, buf, &len);
|
switch_socket_send(listener->sock, buf, &len);
|
||||||
|
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||||
}
|
}
|
||||||
if (!switch_strlen_zero(reply)) {
|
if (!switch_strlen_zero(reply)) {
|
||||||
snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
|
snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
|
||||||
len = strlen(buf) + 1;
|
len = strlen(buf);
|
||||||
switch_socket_send(listener->sock, buf, &len);
|
switch_socket_send(listener->sock, buf, &len);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -830,7 +830,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||||
|
|
||||||
if (!switch_strlen_zero(reply)) {
|
if (!switch_strlen_zero(reply)) {
|
||||||
snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
|
snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
|
||||||
len = strlen(buf) + 1;
|
len = strlen(buf);
|
||||||
switch_socket_send(listener->sock, buf, &len);
|
switch_socket_send(listener->sock, buf, &len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue