comparison src/http/ngx_http_variables.c @ 616:8214eaef3530 NGINX_0_9_6

nginx 0.9.6 *) Feature: the "map" directive supports regular expressions as value of the first parameter. *) Feature: $time_iso8601 access_log variable. Thanks to Michael Lustfield.
author Igor Sysoev <http://sysoev.ru>
date Mon, 21 Mar 2011 00:00:00 +0300
parents c456a023113c
children 83b58b182b76
comparison
equal deleted inserted replaced
615:02221dcea723 616:8214eaef3530
1658 1658
1659 return NGX_OK; 1659 return NGX_OK;
1660 } 1660 }
1661 1661
1662 1662
1663 void *
1664 ngx_http_map_find(ngx_http_request_t *r, ngx_http_map_t *map, ngx_uint_t key,
1665 u_char *text, size_t len, ngx_str_t *match)
1666 {
1667 void *p;
1668
1669 p = ngx_hash_find_combined(&map->hash, key, text, len);
1670 if (p) {
1671 return p;
1672 }
1673
1674 #if (NGX_PCRE)
1675
1676 if (len && map->nregex) {
1677 ngx_int_t n;
1678 ngx_uint_t i;
1679 ngx_http_map_regex_t *reg;
1680
1681 reg = map->regex;
1682
1683 for (i = 0; i < map->nregex; i++) {
1684
1685 n = ngx_http_regex_exec(r, reg[i].regex, match);
1686
1687 if (n == NGX_OK) {
1688 return reg[i].value;
1689 }
1690
1691 if (n == NGX_DECLINED) {
1692 continue;
1693 }
1694
1695 /* NGX_ERROR */
1696
1697 return NULL;
1698 }
1699 }
1700
1701 #endif
1702
1703 return NULL;
1704 }
1705
1706
1663 #if (NGX_PCRE) 1707 #if (NGX_PCRE)
1664 1708
1665 static ngx_int_t 1709 static ngx_int_t
1666 ngx_http_variable_not_found(ngx_http_request_t *r, ngx_http_variable_value_t *v, 1710 ngx_http_variable_not_found(ngx_http_request_t *r, ngx_http_variable_value_t *v,
1667 uintptr_t data) 1711 uintptr_t data)