git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1414 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-05-10 16:10:18 +00:00
parent c1d0488201
commit 9304f3909b
1 changed files with 4 additions and 10 deletions

View File

@ -203,28 +203,22 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, char *f
abyss_bool HandleHook(TSession *r)
{
char *m = "text/html";
char *command, *arg;
switch_stream_handle_t stream = {0};
char *command;
if(strncmp(r->uri, "/api/", 5)) {
return FALSE;
}
command = strdup(r->uri + 5);
if((arg = strchr(command, '/'))) {
*arg++ = '\0';
} else if((arg = strchr(command, '?'))) {
*arg++ = '\0';
}
command = r->uri + 5;
ResponseChunked(r);
ResponseStatus(r,200);
ResponseContentType(r, m);
ResponseWrite(r);
stream.data = r;
stream.write_function = http_stream_write;
switch_api_execute(command, arg, &stream);
switch_api_execute(command, r->query, &stream);
HTTPWriteEnd(r);
free(command);
return TRUE;
}