diff src/core/ngx_inet.c @ 118:644a7935144b NGINX_0_3_6

nginx 0.3.6 *) Change: now the IMAP/POP3 proxy do not send the empty login to authorization server. *) Feature: the "log_format" supports the variables in the $name form. *) Bugfix: if at least in one server was no the "listen" directive, then nginx did not listen on the 80 port; bug appeared in 0.3.3. *) Bugfix: if the URI part is omitted in "proxy_pass" directive, the the 80 port was always used.
author Igor Sysoev <http://sysoev.ru>
date Mon, 24 Oct 2005 00:00:00 +0400
parents dad2fe8ecf08
children df17fbafec8f
line wrap: on
line diff
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -452,7 +452,23 @@ ngx_inet_parse_host_port(ngx_inet_upstre
         }
     }
 
-    if (u->port_text.data == NULL) {
+    if (u->port_text.data) {
+
+        if (u->port_text.len == 0) {
+            u->port_text.len = &url->data[i] - u->port_text.data;
+
+            if (u->port_text.len == 0) {
+                return "invalid port";
+            }
+        }
+
+        port = ngx_atoi(u->port_text.data, u->port_text.len);
+
+        if (port == NGX_ERROR || port < 1 || port > 65536) {
+            return "invalid port";
+        }
+
+    } else {
         port = ngx_atoi(url->data, url->len);
 
         if (port == NGX_ERROR) {
@@ -464,18 +480,6 @@ ngx_inet_parse_host_port(ngx_inet_upstre
 
         u->port_text = *url;
         u->wildcard = 1;
-
-    } else {
-        if (u->port_text.len == 0) {
-            u->default_port = 1;
-            return NULL;
-        }
-
-        port = ngx_atoi(u->port_text.data, u->port_text.len);
-
-        if (port == NGX_ERROR || port < 1 || port > 65536) {
-            return "invalid port";
-        }
     }
 
     u->port = (in_port_t) port;