Mercurial > hg > nginx-vendor-current
comparison src/http/ngx_http_request.c @ 456:ca8f7f6cab16 NGINX_0_7_40
nginx 0.7.40
*) Feature: the "location" directive supports captures in regular
expressions.
*) Feature: an "alias" directive with capture references may be used
inside a location given by a regular expression with captures.
*) Feature: the "server_name" directive supports captures in regular
expressions.
*) Workaround: the ngx_http_autoindex_module did not show the trailing
slash in directories on XFS filesystem; the issue had appeared in
0.7.15.
Thanks to Dmitry Kuzmenko.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 09 Mar 2009 00:00:00 +0300 |
parents | a8424ffa495c |
children | 2e2b57743e87 |
comparison
equal
deleted
inserted
replaced
455:ead634c4b006 | 456:ca8f7f6cab16 |
---|---|
1609 | 1609 |
1610 static ngx_int_t | 1610 static ngx_int_t |
1611 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) | 1611 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) |
1612 { | 1612 { |
1613 u_char *server; | 1613 u_char *server; |
1614 size_t ncaptures; | |
1614 ngx_uint_t hash; | 1615 ngx_uint_t hash; |
1615 ngx_http_virtual_names_t *vn; | 1616 ngx_http_virtual_names_t *vn; |
1616 ngx_http_core_loc_conf_t *clcf; | 1617 ngx_http_core_loc_conf_t *clcf; |
1617 ngx_http_core_srv_conf_t *cscf; | 1618 ngx_http_core_srv_conf_t *cscf; |
1618 u_char buf[32]; | 1619 u_char buf[32]; |
1651 ngx_http_server_name_t *sn; | 1652 ngx_http_server_name_t *sn; |
1652 | 1653 |
1653 name.len = len; | 1654 name.len = len; |
1654 name.data = server; | 1655 name.data = server; |
1655 | 1656 |
1657 ncaptures = 0; | |
1658 | |
1656 sn = vn->regex; | 1659 sn = vn->regex; |
1657 | 1660 |
1658 for (i = 0; i < vn->nregex; i++) { | 1661 for (i = 0; i < vn->nregex; i++) { |
1659 | 1662 |
1660 n = ngx_regex_exec(sn[i].regex, &name, NULL, 0); | 1663 if (sn[i].captures && r->captures == NULL) { |
1664 | |
1665 ncaptures = (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int); | |
1666 | |
1667 r->captures = ngx_palloc(r->pool, ncaptures); | |
1668 if (r->captures == NULL) { | |
1669 return NGX_ERROR; | |
1670 } | |
1671 | |
1672 if (server == buf) { | |
1673 server = ngx_pnalloc(r->pool, len); | |
1674 if (server == NULL) { | |
1675 return NGX_ERROR; | |
1676 } | |
1677 | |
1678 ngx_memcpy(server, buf, len); | |
1679 name.data = server; | |
1680 } | |
1681 } | |
1682 | |
1683 n = ngx_regex_exec(sn[i].regex, &name, r->captures, ncaptures); | |
1661 | 1684 |
1662 if (n == NGX_REGEX_NO_MATCHED) { | 1685 if (n == NGX_REGEX_NO_MATCHED) { |
1663 continue; | 1686 continue; |
1664 } | 1687 } |
1665 | 1688 |
1672 } | 1695 } |
1673 | 1696 |
1674 /* match */ | 1697 /* match */ |
1675 | 1698 |
1676 cscf = sn[i].core_srv_conf; | 1699 cscf = sn[i].core_srv_conf; |
1700 | |
1701 r->ncaptures = ncaptures; | |
1702 r->captures_data = server; | |
1677 | 1703 |
1678 goto found; | 1704 goto found; |
1679 } | 1705 } |
1680 } | 1706 } |
1681 | 1707 |