comparison src/http/modules/ngx_http_map_module.c @ 680:597573166f34 NGINX_1_3_3

nginx 1.3.3 *) Feature: entity tags support and the "etag" directive. *) Bugfix: trailing dot in a source value was not ignored if the "map" directive was used with the "hostnames" parameter. *) Bugfix: incorrect location might be used to process a request if a URI was changed via a "rewrite" directive before an internal redirect to a named location.
author Igor Sysoev <http://sysoev.ru>
date Tue, 10 Jul 2012 00:00:00 +0400
parents d0f7a625f27c
children 660139fd80ca
comparison
equal deleted inserted replaced
679:cad34cec7d3b 680:597573166f34
108 ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, 108 ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
109 uintptr_t data) 109 uintptr_t data)
110 { 110 {
111 ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data; 111 ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data;
112 112
113 size_t len;
114 ngx_str_t val; 113 ngx_str_t val;
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
120 if (ngx_http_complex_value(r, &map->value, &val) != NGX_OK) { 119 if (ngx_http_complex_value(r, &map->value, &val) != NGX_OK) {
121 return NGX_ERROR; 120 return NGX_ERROR;
122 } 121 }
123 122
124 len = val.len; 123 if (map->hostnames && val.len > 0 && val.data[val.len - 1] == '.') {
125 124 val.len--;
126 if (len && map->hostnames && val.data[len - 1] == '.') {
127 len--;
128 } 125 }
129 126
130 value = ngx_http_map_find(r, &map->map, &val); 127 value = ngx_http_map_find(r, &map->map, &val);
131 128
132 if (value == NULL) { 129 if (value == NULL) {
279 } 276 }
280 277
281 map->default_value = ctx.default_value ? ctx.default_value: 278 map->default_value = ctx.default_value ? ctx.default_value:
282 &ngx_http_variable_null_value; 279 &ngx_http_variable_null_value;
283 280
281 map->hostnames = ctx.hostnames;
282
284 hash.key = ngx_hash_key_lc; 283 hash.key = ngx_hash_key_lc;
285 hash.max_size = mcf->hash_max_size; 284 hash.max_size = mcf->hash_max_size;
286 hash.bucket_size = mcf->hash_bucket_size; 285 hash.bucket_size = mcf->hash_bucket_size;
287 hash.name = "map_hash"; 286 hash.name = "map_hash";
288 hash.pool = cf->pool; 287 hash.pool = cf->pool;