comparison src/http/ngx_http_request.c @ 3153:90d6b878481f

update the previous commit: use ngx_strlow()
author Igor Sysoev <igor@sysoev.ru>
date Thu, 24 Sep 2009 13:23:25 +0000
parents 8bf534c7c998
children 60bc5cc68d3b
comparison
equal deleted inserted replaced
3152:8bf534c7c998 3153:90d6b878481f
1614 1614
1615 static ssize_t 1615 static ssize_t
1616 ngx_http_validate_host(ngx_http_request_t *r, u_char **host, size_t len, 1616 ngx_http_validate_host(ngx_http_request_t *r, u_char **host, size_t len,
1617 ngx_uint_t alloc) 1617 ngx_uint_t alloc)
1618 { 1618 {
1619 u_char *p, *h, ch; 1619 u_char *h, ch;
1620 size_t i, last; 1620 size_t i, last;
1621 ngx_uint_t dot; 1621 ngx_uint_t dot;
1622 1622
1623 last = len; 1623 last = len;
1624 h = *host; 1624 h = *host;
1655 if (dot) { 1655 if (dot) {
1656 last--; 1656 last--;
1657 } 1657 }
1658 1658
1659 if (alloc) { 1659 if (alloc) {
1660 p = ngx_pnalloc(r->pool, last) ; 1660 *host = ngx_pnalloc(r->pool, last) ;
1661 if (p == NULL) { 1661 if (*host == NULL) {
1662 return -1; 1662 return -1;
1663 } 1663 }
1664 1664
1665 *host = p; 1665 ngx_strlow(*host, h, last);
1666
1667 for (i = 0; i < last; i++) {
1668 *p++ = ngx_tolower(h[i]);
1669 }
1670 } 1666 }
1671 1667
1672 return last; 1668 return last;
1673 } 1669 }
1674 1670