comparison src/http/modules/ngx_http_map_module.c @ 628:83b58b182b76 NGINX_1_0_4

nginx 1.0.4 *) Change: now regular expressions case sensitivity in the "map" directive is given by prefixes "~" or "~*". *) Feature: now shared zones and caches use POSIX semaphores on Linux. Thanks to Denis F. Latypoff. *) Bugfix: "stalled" cache updating" alert. *) Bugfix: nginx could not be built --without-http_auth_basic_module; the bug had appeared in 1.0.3.
author Igor Sysoev <http://sysoev.ru>
date Wed, 01 Jun 2011 00:00:00 +0400
parents 8214eaef3530
children d0f7a625f27c
comparison
equal deleted inserted replaced
627:a63a292c61af 628:83b58b182b76
109 { 109 {
110 ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data; 110 ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data;
111 111
112 size_t len; 112 size_t len;
113 ngx_str_t val; 113 ngx_str_t val;
114 ngx_uint_t key;
115 ngx_http_variable_value_t *value; 114 ngx_http_variable_value_t *value;
116 115
117 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 116 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
118 "http map started"); 117 "http map started");
119 118
125 124
126 if (len && map->hostnames && val.data[len - 1] == '.') { 125 if (len && map->hostnames && val.data[len - 1] == '.') {
127 len--; 126 len--;
128 } 127 }
129 128
130 key = ngx_hash_strlow(val.data, val.data, len); 129 value = ngx_http_map_find(r, &map->map, &val);
131
132 value = ngx_http_map_find(r, &map->map, key, val.data, len, &val);
133 130
134 if (value == NULL) { 131 if (value == NULL) {
135 value = map->default_value; 132 value = map->default_value;
136 } 133 }
137 134
527 value[0].len--; 524 value[0].len--;
528 value[0].data++; 525 value[0].data++;
529 526
530 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); 527 ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
531 528
529 if (value[0].data[0] == '*') {
530 value[0].len--;
531 value[0].data++;
532 rc.options = NGX_REGEX_CASELESS;
533 }
534
532 rc.pattern = value[0]; 535 rc.pattern = value[0];
533 rc.err.len = NGX_MAX_CONF_ERRSTR; 536 rc.err.len = NGX_MAX_CONF_ERRSTR;
534 rc.err.data = errstr; 537 rc.err.data = errstr;
535 538
536 regex->regex = ngx_http_regex_compile(ctx->cf, &rc); 539 regex->regex = ngx_http_regex_compile(ctx->cf, &rc);