Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 2533:c843171d5dc2
axe r->port_text
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 24 Feb 2009 07:29:55 +0000 |
parents | 5d53ad3a8319 |
children | 2749e4bf6af0 |
comparison
equal
deleted
inserted
replaced
2532:aa53ef3e36e9 | 2533:c843171d5dc2 |
---|---|
1601 | 1601 |
1602 | 1602 |
1603 static ngx_int_t | 1603 static ngx_int_t |
1604 ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port) | 1604 ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port) |
1605 { | 1605 { |
1606 ngx_uint_t i, a, last, bind_wildcard; | 1606 ngx_uint_t i, last, bind_wildcard; |
1607 ngx_listening_t *ls; | 1607 ngx_listening_t *ls; |
1608 ngx_http_port_t *hport; | 1608 ngx_http_port_t *hport; |
1609 ngx_http_conf_addr_t *addr; | 1609 ngx_http_conf_addr_t *addr; |
1610 | 1610 |
1611 addr = port->addrs.elts; | 1611 addr = port->addrs.elts; |
1624 | 1624 |
1625 } else { | 1625 } else { |
1626 bind_wildcard = 0; | 1626 bind_wildcard = 0; |
1627 } | 1627 } |
1628 | 1628 |
1629 a = 0; | 1629 i = 0; |
1630 | 1630 |
1631 while (a < last) { | 1631 while (i < last) { |
1632 | 1632 |
1633 if (bind_wildcard && !addr[a].bind) { | 1633 if (bind_wildcard && !addr[i].bind) { |
1634 a++; | 1634 i++; |
1635 continue; | 1635 continue; |
1636 } | 1636 } |
1637 | 1637 |
1638 ls = ngx_http_add_listening(cf, &addr[a]); | 1638 ls = ngx_http_add_listening(cf, &addr[i]); |
1639 if (ls == NULL) { | 1639 if (ls == NULL) { |
1640 return NGX_ERROR; | 1640 return NGX_ERROR; |
1641 } | 1641 } |
1642 | 1642 |
1643 hport = ngx_pcalloc(cf->pool, sizeof(ngx_http_port_t)); | 1643 hport = ngx_pcalloc(cf->pool, sizeof(ngx_http_port_t)); |
1645 return NGX_ERROR; | 1645 return NGX_ERROR; |
1646 } | 1646 } |
1647 | 1647 |
1648 ls->servers = hport; | 1648 ls->servers = hport; |
1649 | 1649 |
1650 for (i = ls->addr_text.len - 1; i; i--) { | 1650 if (i == last - 1) { |
1651 | |
1652 if (ls->addr_text.data[i] == ':') { | |
1653 hport->port_text.len = ls->addr_text.len - i; | |
1654 hport->port_text.data = &ls->addr_text.data[i]; | |
1655 break; | |
1656 } | |
1657 } | |
1658 | |
1659 if (a == last - 1) { | |
1660 hport->naddrs = last; | 1651 hport->naddrs = last; |
1661 | 1652 |
1662 } else { | 1653 } else { |
1663 hport->naddrs = 1; | 1654 hport->naddrs = 1; |
1664 a = 0; | 1655 i = 0; |
1665 } | 1656 } |
1666 | 1657 |
1667 switch (ls->sockaddr->sa_family) { | 1658 switch (ls->sockaddr->sa_family) { |
1668 | 1659 |
1669 #if (NGX_HAVE_INET6) | 1660 #if (NGX_HAVE_INET6) |