diff src/http/ngx_http_core_module.c @ 417:0526206251f6

nginx-0.0.10-2004-09-07-19:29:22 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 07 Sep 2004 15:29:22 +0000
parents b9bd635011de
children bd39260a1383
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1473,7 +1473,8 @@ static char *ngx_set_listen(ngx_conf_t *
     ngx_http_core_srv_conf_t *scf = conf;
 
     u_char             *addr;
-    u_int               p;
+    ngx_int_t           port;
+    ngx_uint_t          p;
     struct hostent     *h;
     ngx_str_t          *args;
     ngx_http_listen_t  *ls;
@@ -1505,14 +1506,14 @@ static char *ngx_set_listen(ngx_conf_t *
         p = 0;
     }
 
-    ls->port = ngx_atoi(&addr[p], args[1].len - p);
-    if (ls->port == NGX_ERROR && p == 0) {
+    port = ngx_atoi(&addr[p], args[1].len - p);
+    if (port == NGX_ERROR && p == 0) {
 
         /* "listen host" */
         ls->port = 80;
 
-    } else if ((ls->port == NGX_ERROR && p != 0) /* "listen host:NONNUMBER" */
-               || (ls->port < 1 || ls->port > 65536)) { /* "listen 99999" */
+    } else if ((port == NGX_ERROR && p != 0) /* "listen host:NONNUMBER" */
+               || (port < 1 || port > 65536)) { /* "listen 99999" */
 
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                            "invalid port \"%s\" in \"%s\" directive, "
@@ -1523,6 +1524,7 @@ static char *ngx_set_listen(ngx_conf_t *
 
     } else if (p == 0) {
         ls->addr = INADDR_ANY;
+        ls->port = (in_port_t) port;
         return NGX_CONF_OK;
     }