fix a pointer signedness issue
[asterisk/asterisk.git] / http.c
diff --git a/http.c b/http.c
index 8341d63..a6bc5b0 100644 (file)
--- a/http.c
+++ b/http.c
  * \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"
@@ -125,12 +125,12 @@ static char *static_callback(struct sockaddr_in *req, const char *uri, struct as
        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))
@@ -461,7 +461,7 @@ static void *http_root(void *data)
 {
        int fd;
        struct sockaddr_in sin;
-       int sinlen;
+       socklen_t sinlen;
        struct ast_http_server_instance *ser;
        pthread_t launched;
        pthread_attr_t attr;
@@ -493,9 +493,6 @@ static void *http_root(void *data)
                                close(ser->fd);
                                free(ser);
                        }
-               } else {
-                       close(ser->fd);
-                       free(ser);
                }
        }
        return NULL;
@@ -632,7 +629,7 @@ static int handle_show_http(int fd, int argc, char *argv[])
 {
        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);
@@ -659,11 +656,11 @@ int ast_http_reload(void)
 }
 
 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 },
 };