Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 2136:7a7c9e9024dd
ngx_hash_strlow()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 04 Aug 2008 10:18:36 +0000 |
parents | 8c6521eedf84 |
children | 76d5af541412 |
comparison
equal
deleted
inserted
replaced
2135:8c6521eedf84 | 2136:7a7c9e9024dd |
---|---|
1547 | 1547 |
1548 | 1548 |
1549 static ngx_int_t | 1549 static ngx_int_t |
1550 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) | 1550 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) |
1551 { | 1551 { |
1552 u_char *server, ch; | 1552 u_char *server; |
1553 ngx_uint_t i, hash; | 1553 ngx_uint_t hash; |
1554 ngx_http_core_loc_conf_t *clcf; | 1554 ngx_http_core_loc_conf_t *clcf; |
1555 ngx_http_core_srv_conf_t *cscf; | 1555 ngx_http_core_srv_conf_t *cscf; |
1556 u_char buf[32]; | 1556 u_char buf[32]; |
1557 | 1557 |
1558 if (len == 0 || r->virtual_names == NULL) { | 1558 if (len == 0 || r->virtual_names == NULL) { |
1567 if (server == NULL) { | 1567 if (server == NULL) { |
1568 return NGX_ERROR; | 1568 return NGX_ERROR; |
1569 } | 1569 } |
1570 } | 1570 } |
1571 | 1571 |
1572 hash = 0; | 1572 hash = ngx_hash_strlow(server, host, len); |
1573 | |
1574 for (i = 0; i < len; i++) { | |
1575 ch = host[i]; | |
1576 | |
1577 ch = ngx_tolower(ch); | |
1578 server[i] = ch; | |
1579 | |
1580 hash = ngx_hash(hash, ch); | |
1581 } | |
1582 | 1573 |
1583 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len); | 1574 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len); |
1584 | 1575 |
1585 if (cscf) { | 1576 if (cscf) { |
1586 goto found; | 1577 goto found; |