* \ref AstHTTP - AMI over the http protocol
*/
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
#include "asterisk/cli.h"
#include "asterisk/http.h"
#include "asterisk/utils.h"
mtype=ftype2mtype(ftype, wkspace, sizeof(wkspace));
/* Cap maximum length */
- len = strlen(uri) + strlen(ast_config_AST_VAR_DIR) + strlen("/static-http/") + 5;
+ len = strlen(uri) + strlen(ast_config_AST_DATA_DIR) + strlen("/static-http/") + 5;
if (len > 1024)
goto out403;
path = alloca(len);
- sprintf(path, "%s/static-http/%s", ast_config_AST_VAR_DIR, uri);
+ sprintf(path, "%s/static-http/%s", ast_config_AST_DATA_DIR, uri);
if (stat(path, &st))
goto out404;
if (S_ISDIR(st.st_mode))
{
int fd;
struct sockaddr_in sin;
- int sinlen;
+ socklen_t sinlen;
struct ast_http_server_instance *ser;
pthread_t launched;
pthread_attr_t attr;
close(ser->fd);
free(ser);
}
- } else {
- close(ser->fd);
- free(ser);
}
}
return NULL;
{
char iabuf[INET_ADDRSTRLEN];
struct ast_http_uri *urih;
- if (argc != 2)
+ if (argc != 3)
return RESULT_SHOWUSAGE;
ast_cli(fd, "HTTP Server Status:\n");
ast_cli(fd, "Prefix: %s\n", prefix);
}
static char show_http_help[] =
-"Usage: show http\n"
+"Usage: http show status\n"
" Shows status of internal HTTP engine\n";
static struct ast_cli_entry http_cli[] = {
- { { "show", "http", NULL }, handle_show_http,
+ { { "http", "show", "status", NULL }, handle_show_http,
"Display HTTP server status", show_http_help },
};