summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-07-21 17:31:28 +0000
committerRussell Bryant <russell@russellbryant.com>2006-07-21 17:31:28 +0000
commitca9ba719b6f4ef598bc3dc71bdee05d11d0c7687 (patch)
tree9a03027276c525f44c08eb5dc4d7b9035fa697c9 /http.c
parent1861dcdff5666cbac27288f7bdfdf40104d29d4d (diff)
Merge a new implementation of ast_inet_ntoa, our thread safe replacement for
inet_ntoa, which uses thread specific data (aka thread local storage) instead of stack allocatted buffers to store the result. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'http.c')
-rw-r--r--http.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/http.c b/http.c
index 8971579d9..9e24c5e60 100644
--- a/http.c
+++ b/http.c
@@ -174,7 +174,6 @@ static char *httpstatus_callback(struct sockaddr_in *req, const char *uri, struc
size_t reslen = sizeof(result);
char *c=result;
struct ast_variable *v;
- char iabuf[INET_ADDRSTRLEN];
ast_build_string(&c, &reslen,
"\r\n"
@@ -185,7 +184,7 @@ static char *httpstatus_callback(struct sockaddr_in *req, const char *uri, struc
ast_build_string(&c, &reslen, "<tr><td><i>Prefix</i></td><td><b>%s</b></td></tr>\r\n", prefix);
ast_build_string(&c, &reslen, "<tr><td><i>Bind Address</i></td><td><b>%s</b></td></tr>\r\n",
- ast_inet_ntoa(iabuf, sizeof(iabuf), oldsin.sin_addr));
+ ast_inet_ntoa(oldsin.sin_addr));
ast_build_string(&c, &reslen, "<tr><td><i>Bind Port</i></td><td><b>%d</b></td></tr>\r\n",
ntohs(oldsin.sin_port));
ast_build_string(&c, &reslen, "<tr><td colspan=\"2\"><hr></td></tr>\r\n");
@@ -513,7 +512,6 @@ char *ast_http_setcookie(const char *var, const char *val, int expires, char *bu
static void http_server_start(struct sockaddr_in *sin)
{
- char iabuf[INET_ADDRSTRLEN];
int flags;
int x = 1;
@@ -549,7 +547,7 @@ static void http_server_start(struct sockaddr_in *sin)
setsockopt(httpfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
if (bind(httpfd, (struct sockaddr *)sin, sizeof(*sin))) {
ast_log(LOG_NOTICE, "Unable to bind http server to %s:%d: %s\n",
- ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), ntohs(sin->sin_port),
+ ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port),
strerror(errno));
close(httpfd);
httpfd = -1;
@@ -565,7 +563,7 @@ static void http_server_start(struct sockaddr_in *sin)
fcntl(httpfd, F_SETFL, flags | O_NONBLOCK);
if (ast_pthread_create(&master, NULL, http_root, NULL)) {
ast_log(LOG_NOTICE, "Unable to launch http server on %s:%d: %s\n",
- ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), ntohs(sin->sin_port),
+ ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port),
strerror(errno));
close(httpfd);
httpfd = -1;
@@ -628,7 +626,6 @@ static int __ast_http_load(int reload)
static int handle_show_http(int fd, int argc, char *argv[])
{
- char iabuf[INET_ADDRSTRLEN];
struct ast_http_uri *urih;
if (argc != 3)
return RESULT_SHOWUSAGE;
@@ -636,7 +633,7 @@ static int handle_show_http(int fd, int argc, char *argv[])
ast_cli(fd, "Prefix: %s\n", prefix);
if (oldsin.sin_family)
ast_cli(fd, "Server Enabled and Bound to %s:%d\n\n",
- ast_inet_ntoa(iabuf, sizeof(iabuf), oldsin.sin_addr),
+ ast_inet_ntoa(oldsin.sin_addr),
ntohs(oldsin.sin_port));
else
ast_cli(fd, "Server Disabled\n\n");