Skip to content

Commit

Permalink
Removed a surplus condition from ngx_parse_inet6_url().
Browse files Browse the repository at this point in the history
No functional changes, since the condition was always true.
  • Loading branch information
mdocguard committed May 11, 2016
1 parent 66be8c6 commit 41d512c
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions src/core/ngx_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,52 +843,49 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
return NGX_ERROR;
}

if (last - p) {
port = p + 1;

port = p + 1;
uri = ngx_strlchr(port, last, '/');

uri = ngx_strlchr(port, last, '/');
if (uri) {
if (u->listen || !u->uri_part) {
u->err = "invalid host";
return NGX_ERROR;
}

if (uri) {
if (u->listen || !u->uri_part) {
u->err = "invalid host";
return NGX_ERROR;
}
u->uri.len = last - uri;
u->uri.data = uri;

u->uri.len = last - uri;
u->uri.data = uri;
last = uri;
}

last = uri;
if (port < last) {
if (*port != ':') {
u->err = "invalid host";
return NGX_ERROR;
}

if (port < last) {
if (*port != ':') {
u->err = "invalid host";
return NGX_ERROR;
}

port++;
port++;

len = last - port;
len = last - port;

n = ngx_atoi(port, len);
n = ngx_atoi(port, len);

if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}

u->port = (in_port_t) n;
sin6->sin6_port = htons((in_port_t) n);
u->port = (in_port_t) n;
sin6->sin6_port = htons((in_port_t) n);

u->port_text.len = len;
u->port_text.data = port;
u->port_text.len = len;
u->port_text.data = port;

} else {
u->no_port = 1;
u->port = u->default_port;
sin6->sin6_port = htons(u->default_port);
}
} else {
u->no_port = 1;
u->port = u->default_port;
sin6->sin6_port = htons(u->default_port);
}

len = p - host;
Expand Down

0 comments on commit 41d512c

Please sign in to comment.