Mercurial > hg > nginx-ranges
comparison src/http/ngx_http_variables.c @ 595:c456a023113c NGINX_0_8_43
nginx 0.8.43
*) Feature: large geo ranges base loading speed-up.
*) Bugfix: an error_page redirection to "location /zero { return 204;
}" without changing status code kept the error body; the bug had
appeared in 0.8.42.
*) Bugfix: nginx might close IPv6 listen socket during
reconfiguration.
Thanks to Maxim Dounin.
*) Bugfix: the $uid_set variable may be used at any request processing
stage.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 30 Jun 2010 00:00:00 +0400 |
parents | 8246d8a2c2be |
children | 8214eaef3530 |
comparison
equal
deleted
inserted
replaced
594:22b2345b75d9 | 595:c456a023113c |
---|---|
1971 | 1971 |
1972 cmcf->variables_keys = NULL; | 1972 cmcf->variables_keys = NULL; |
1973 | 1973 |
1974 return NGX_OK; | 1974 return NGX_OK; |
1975 } | 1975 } |
1976 | |
1977 | |
1978 void | |
1979 ngx_http_variable_value_rbtree_insert(ngx_rbtree_node_t *temp, | |
1980 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) | |
1981 { | |
1982 ngx_rbtree_node_t **p; | |
1983 ngx_http_variable_value_node_t *vvn, *vvt; | |
1984 | |
1985 for ( ;; ) { | |
1986 | |
1987 vvn = (ngx_http_variable_value_node_t *) node; | |
1988 vvt = (ngx_http_variable_value_node_t *) temp; | |
1989 | |
1990 if (node->key != temp->key) { | |
1991 | |
1992 p = (node->key < temp->key) ? &temp->left : &temp->right; | |
1993 | |
1994 } else if (vvn->len != vvt->len) { | |
1995 | |
1996 p = (vvn->len < vvt->len) ? &temp->left : &temp->right; | |
1997 | |
1998 } else { | |
1999 p = (ngx_memcmp(vvn->value->data, vvt->value->data, vvn->len) < 0) | |
2000 ? &temp->left : &temp->right; | |
2001 } | |
2002 | |
2003 if (*p == sentinel) { | |
2004 break; | |
2005 } | |
2006 | |
2007 temp = *p; | |
2008 } | |
2009 | |
2010 *p = node; | |
2011 node->parent = temp; | |
2012 node->left = sentinel; | |
2013 node->right = sentinel; | |
2014 ngx_rbt_red(node); | |
2015 } | |
2016 | |
2017 | |
2018 ngx_http_variable_value_t * | |
2019 ngx_http_variable_value_lookup(ngx_rbtree_t *rbtree, ngx_str_t *val, | |
2020 uint32_t hash) | |
2021 { | |
2022 ngx_int_t rc; | |
2023 ngx_rbtree_node_t *node, *sentinel; | |
2024 ngx_http_variable_value_node_t *vvn; | |
2025 | |
2026 node = rbtree->root; | |
2027 sentinel = rbtree->sentinel; | |
2028 | |
2029 while (node != sentinel) { | |
2030 | |
2031 vvn = (ngx_http_variable_value_node_t *) node; | |
2032 | |
2033 if (hash != node->key) { | |
2034 node = (hash < node->key) ? node->left : node->right; | |
2035 continue; | |
2036 } | |
2037 | |
2038 if (val->len != vvn->len) { | |
2039 node = (val->len < vvn->len) ? node->left : node->right; | |
2040 continue; | |
2041 } | |
2042 | |
2043 rc = ngx_memcmp(val->data, vvn->value->data, val->len); | |
2044 | |
2045 if (rc < 0) { | |
2046 node = node->left; | |
2047 continue; | |
2048 } | |
2049 | |
2050 if (rc > 0) { | |
2051 node = node->right; | |
2052 continue; | |
2053 } | |
2054 | |
2055 return vvn->value; | |
2056 } | |
2057 | |
2058 return NULL; | |
2059 } |