Mercurial > hg > nginx-quic
annotate src/http/modules/ngx_http_map_module.c @ 4622:0dfdc3f732cb
Upstream: fixed ip_hash rebalancing with the "down" flag.
Due to weight being set to 0 for down peers, order of peers after sorting
wasn't the same as without the "down" flag (with down peers at the end),
resulting in client rebalancing for clients on other servers. The only
rebalancing which should happen after adding "down" to a server is one
for clients on the server.
The problem was introduced in r1377 (which fixed endless loop by setting
weight to 0 for down servers). The loop is no longer possible with new
smooth algorithm, so preserving original weight is safe.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 14 May 2012 09:58:07 +0000 |
parents | d620f497c50f |
children | fd3eefefa5f9 |
rev | line source |
---|---|
589 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
589 | 5 */ |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_http.h> | |
11 | |
12 | |
13 typedef struct { | |
14 ngx_uint_t hash_max_size; | |
15 ngx_uint_t hash_bucket_size; | |
16 } ngx_http_map_conf_t; | |
17 | |
18 | |
19 typedef struct { | |
593 | 20 ngx_hash_keys_arrays_t keys; |
589 | 21 |
22 ngx_array_t *values_hash; | |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
23 ngx_array_t var_values; |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
24 #if (NGX_PCRE) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
25 ngx_array_t regexes; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
26 #endif |
589 | 27 |
28 ngx_http_variable_value_t *default_value; | |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
29 ngx_conf_t *cf; |
589 | 30 ngx_uint_t hostnames; /* unsigned hostnames:1 */ |
31 } ngx_http_map_conf_ctx_t; | |
32 | |
33 | |
34 typedef struct { | |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
35 ngx_http_map_t map; |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
36 ngx_http_complex_value_t value; |
589 | 37 ngx_http_variable_value_t *default_value; |
38 ngx_uint_t hostnames; /* unsigned hostnames:1 */ | |
39 } ngx_http_map_ctx_t; | |
40 | |
41 | |
42 static int ngx_libc_cdecl ngx_http_map_cmp_dns_wildcards(const void *one, | |
43 const void *two); | |
44 static void *ngx_http_map_create_conf(ngx_conf_t *cf); | |
45 static char *ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | |
46 static char *ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); | |
47 | |
48 | |
49 static ngx_command_t ngx_http_map_commands[] = { | |
50 | |
51 { ngx_string("map"), | |
52 NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2, | |
53 ngx_http_map_block, | |
54 NGX_HTTP_MAIN_CONF_OFFSET, | |
55 0, | |
56 NULL }, | |
57 | |
58 { ngx_string("map_hash_max_size"), | |
59 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | |
60 ngx_conf_set_num_slot, | |
61 NGX_HTTP_MAIN_CONF_OFFSET, | |
62 offsetof(ngx_http_map_conf_t, hash_max_size), | |
63 NULL }, | |
64 | |
65 { ngx_string("map_hash_bucket_size"), | |
66 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | |
67 ngx_conf_set_num_slot, | |
68 NGX_HTTP_MAIN_CONF_OFFSET, | |
69 offsetof(ngx_http_map_conf_t, hash_bucket_size), | |
70 NULL }, | |
71 | |
72 ngx_null_command | |
73 }; | |
74 | |
75 | |
76 static ngx_http_module_t ngx_http_map_module_ctx = { | |
77 NULL, /* preconfiguration */ | |
78 NULL, /* postconfiguration */ | |
79 | |
80 ngx_http_map_create_conf, /* create main configuration */ | |
81 NULL, /* init main configuration */ | |
82 | |
83 NULL, /* create server configuration */ | |
84 NULL, /* merge server configuration */ | |
85 | |
86 NULL, /* create location configuration */ | |
87 NULL /* merge location configuration */ | |
88 }; | |
89 | |
90 | |
91 ngx_module_t ngx_http_map_module = { | |
92 NGX_MODULE_V1, | |
93 &ngx_http_map_module_ctx, /* module context */ | |
94 ngx_http_map_commands, /* module directives */ | |
95 NGX_HTTP_MODULE, /* module type */ | |
96 NULL, /* init master */ | |
97 NULL, /* init module */ | |
98 NULL, /* init process */ | |
99 NULL, /* init thread */ | |
100 NULL, /* exit thread */ | |
101 NULL, /* exit process */ | |
102 NULL, /* exit master */ | |
103 NGX_MODULE_V1_PADDING | |
104 }; | |
105 | |
106 | |
107 static ngx_int_t | |
108 ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, | |
109 uintptr_t data) | |
110 { | |
111 ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data; | |
112 | |
113 size_t len; | |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
114 ngx_str_t val; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
115 ngx_http_variable_value_t *value; |
589 | 116 |
117 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
118 "http map started"); | |
119 | |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
120 if (ngx_http_complex_value(r, &map->value, &val) != NGX_OK) { |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
121 return NGX_ERROR; |
797
36f7b549f481
fix segfault if $server_addr failed
Igor Sysoev <igor@sysoev.ru>
parents:
637
diff
changeset
|
122 } |
36f7b549f481
fix segfault if $server_addr failed
Igor Sysoev <igor@sysoev.ru>
parents:
637
diff
changeset
|
123 |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
124 len = val.len; |
589 | 125 |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
126 if (len && map->hostnames && val.data[len - 1] == '.') { |
589 | 127 len--; |
128 } | |
129 | |
3929
fa4612bfb9fa
change ngx_http_map_find(): use case sensitive regexes
Igor Sysoev <igor@sysoev.ru>
parents:
3874
diff
changeset
|
130 value = ngx_http_map_find(r, &map->map, &val); |
589 | 131 |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
132 if (value == NULL) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
133 value = map->default_value; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
134 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
135 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
136 if (!value->valid) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
137 value = ngx_http_get_flushed_variable(r, (ngx_uint_t) value->data); |
589 | 138 |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
139 if (value == NULL || value->not_found) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
140 value = &ngx_http_variable_null_value; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
141 } |
589 | 142 } |
143 | |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
144 *v = *value; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
145 |
589 | 146 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
147 "http map: \"%v\" \"%v\"", &val, v); |
589 | 148 |
149 return NGX_OK; | |
150 } | |
151 | |
152 | |
153 static void * | |
154 ngx_http_map_create_conf(ngx_conf_t *cf) | |
155 { | |
156 ngx_http_map_conf_t *mcf; | |
157 | |
158 mcf = ngx_palloc(cf->pool, sizeof(ngx_http_map_conf_t)); | |
159 if (mcf == NULL) { | |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2536
diff
changeset
|
160 return NULL; |
589 | 161 } |
162 | |
163 mcf->hash_max_size = NGX_CONF_UNSET_UINT; | |
164 mcf->hash_bucket_size = NGX_CONF_UNSET_UINT; | |
165 | |
166 return mcf; | |
167 } | |
168 | |
169 | |
170 static char * | |
171 ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
172 { | |
173 ngx_http_map_conf_t *mcf = conf; | |
174 | |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
175 char *rv; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
176 ngx_str_t *value, name; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
177 ngx_conf_t save; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
178 ngx_pool_t *pool; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
179 ngx_hash_init_t hash; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
180 ngx_http_map_ctx_t *map; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
181 ngx_http_variable_t *var; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
182 ngx_http_map_conf_ctx_t ctx; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
183 ngx_http_compile_complex_value_t ccv; |
589 | 184 |
185 if (mcf->hash_max_size == NGX_CONF_UNSET_UINT) { | |
186 mcf->hash_max_size = 2048; | |
187 } | |
188 | |
189 if (mcf->hash_bucket_size == NGX_CONF_UNSET_UINT) { | |
190 mcf->hash_bucket_size = ngx_cacheline_size; | |
191 | |
192 } else { | |
193 mcf->hash_bucket_size = ngx_align(mcf->hash_bucket_size, | |
194 ngx_cacheline_size); | |
195 } | |
196 | |
197 map = ngx_pcalloc(cf->pool, sizeof(ngx_http_map_ctx_t)); | |
198 if (map == NULL) { | |
199 return NGX_CONF_ERROR; | |
200 } | |
201 | |
202 value = cf->args->elts; | |
203 | |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
204 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
589 | 205 |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
206 ccv.cf = cf; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
207 ccv.value = &value[1]; |
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
208 ccv.complex_value = &map->value; |
589 | 209 |
3789
19c931be8b98
allow expressions in the first "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
210 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
589 | 211 return NGX_CONF_ERROR; |
212 } | |
213 | |
214 name = value[2]; | |
215 name.len--; | |
216 name.data++; | |
217 | |
1565 | 218 var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); |
589 | 219 if (var == NULL) { |
220 return NGX_CONF_ERROR; | |
221 } | |
222 | |
637 | 223 var->get_handler = ngx_http_map_variable; |
589 | 224 var->data = (uintptr_t) map; |
225 | |
226 pool = ngx_create_pool(16384, cf->log); | |
227 if (pool == NULL) { | |
228 return NGX_CONF_ERROR; | |
229 } | |
230 | |
593 | 231 ctx.keys.pool = cf->pool; |
232 ctx.keys.temp_pool = pool; | |
589 | 233 |
593 | 234 if (ngx_hash_keys_array_init(&ctx.keys, NGX_HASH_LARGE) != NGX_OK) { |
589 | 235 ngx_destroy_pool(pool); |
236 return NGX_CONF_ERROR; | |
237 } | |
238 | |
593 | 239 ctx.values_hash = ngx_pcalloc(pool, sizeof(ngx_array_t) * ctx.keys.hsize); |
589 | 240 if (ctx.values_hash == NULL) { |
241 ngx_destroy_pool(pool); | |
242 return NGX_CONF_ERROR; | |
243 } | |
244 | |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
245 if (ngx_array_init(&ctx.var_values, cf->pool, 2, |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
246 sizeof(ngx_http_variable_value_t)) |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
247 != NGX_OK) |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
248 { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
249 ngx_destroy_pool(pool); |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
250 return NGX_CONF_ERROR; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
251 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
252 |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
253 #if (NGX_PCRE) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
254 if (ngx_array_init(&ctx.regexes, cf->pool, 2, sizeof(ngx_http_map_regex_t)) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
255 != NGX_OK) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
256 { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
257 ngx_destroy_pool(pool); |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
258 return NGX_CONF_ERROR; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
259 } |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
260 #endif |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
261 |
589 | 262 ctx.default_value = NULL; |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
263 ctx.cf = &save; |
589 | 264 ctx.hostnames = 0; |
265 | |
266 save = *cf; | |
267 cf->pool = pool; | |
268 cf->ctx = &ctx; | |
269 cf->handler = ngx_http_map; | |
270 cf->handler_conf = conf; | |
271 | |
272 rv = ngx_conf_parse(cf, NULL); | |
273 | |
274 *cf = save; | |
275 | |
276 if (rv != NGX_CONF_OK) { | |
277 ngx_destroy_pool(pool); | |
278 return rv; | |
279 } | |
280 | |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
281 map->default_value = ctx.default_value ? ctx.default_value: |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
282 &ngx_http_variable_null_value; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
283 |
589 | 284 hash.key = ngx_hash_key_lc; |
285 hash.max_size = mcf->hash_max_size; | |
286 hash.bucket_size = mcf->hash_bucket_size; | |
287 hash.name = "map_hash"; | |
288 hash.pool = cf->pool; | |
289 | |
593 | 290 if (ctx.keys.keys.nelts) { |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
291 hash.hash = &map->map.hash.hash; |
589 | 292 hash.temp_pool = NULL; |
293 | |
593 | 294 if (ngx_hash_init(&hash, ctx.keys.keys.elts, ctx.keys.keys.nelts) |
591 | 295 != NGX_OK) |
296 { | |
593 | 297 ngx_destroy_pool(pool); |
589 | 298 return NGX_CONF_ERROR; |
299 } | |
300 } | |
301 | |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
302 if (ctx.keys.dns_wc_head.nelts) { |
589 | 303 |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
304 ngx_qsort(ctx.keys.dns_wc_head.elts, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
305 (size_t) ctx.keys.dns_wc_head.nelts, |
589 | 306 sizeof(ngx_hash_key_t), ngx_http_map_cmp_dns_wildcards); |
307 | |
308 hash.hash = NULL; | |
309 hash.temp_pool = pool; | |
310 | |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
311 if (ngx_hash_wildcard_init(&hash, ctx.keys.dns_wc_head.elts, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
312 ctx.keys.dns_wc_head.nelts) |
589 | 313 != NGX_OK) |
314 { | |
593 | 315 ngx_destroy_pool(pool); |
589 | 316 return NGX_CONF_ERROR; |
317 } | |
318 | |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
319 map->map.hash.wc_head = (ngx_hash_wildcard_t *) hash.hash; |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
320 } |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
321 |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
322 if (ctx.keys.dns_wc_tail.nelts) { |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
323 |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
324 ngx_qsort(ctx.keys.dns_wc_tail.elts, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
325 (size_t) ctx.keys.dns_wc_tail.nelts, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
326 sizeof(ngx_hash_key_t), ngx_http_map_cmp_dns_wildcards); |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
327 |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
328 hash.hash = NULL; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
329 hash.temp_pool = pool; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
330 |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
331 if (ngx_hash_wildcard_init(&hash, ctx.keys.dns_wc_tail.elts, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
332 ctx.keys.dns_wc_tail.nelts) |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
333 != NGX_OK) |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
334 { |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
335 ngx_destroy_pool(pool); |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
336 return NGX_CONF_ERROR; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
337 } |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
338 |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
339 map->map.hash.wc_tail = (ngx_hash_wildcard_t *) hash.hash; |
589 | 340 } |
341 | |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
342 #if (NGX_PCRE) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
343 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
344 if (ctx.regexes.nelts) { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
345 map->map.regex = ctx.regexes.elts; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
346 map->map.nregex = ctx.regexes.nelts; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
347 } |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
348 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
349 #endif |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
350 |
589 | 351 ngx_destroy_pool(pool); |
352 | |
353 return rv; | |
354 } | |
355 | |
356 | |
357 static int ngx_libc_cdecl | |
358 ngx_http_map_cmp_dns_wildcards(const void *one, const void *two) | |
359 { | |
360 ngx_hash_key_t *first, *second; | |
361 | |
362 first = (ngx_hash_key_t *) one; | |
363 second = (ngx_hash_key_t *) two; | |
364 | |
3116
98e288c6dac3
If .domain.com, .sub.domain.com, and .domain-some.com were defined,
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
365 return ngx_dns_strcmp(first->key.data, second->key.data); |
589 | 366 } |
367 | |
368 | |
369 static char * | |
370 ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) | |
371 { | |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
372 ngx_int_t rc, index; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
373 ngx_str_t *value, file, name; |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
374 ngx_uint_t i, key; |
589 | 375 ngx_http_map_conf_ctx_t *ctx; |
591 | 376 ngx_http_variable_value_t *var, **vp; |
589 | 377 |
378 ctx = cf->ctx; | |
379 | |
380 value = cf->args->elts; | |
381 | |
382 if (cf->args->nelts == 1 | |
383 && ngx_strcmp(value[0].data, "hostnames") == 0) | |
384 { | |
385 ctx->hostnames = 1; | |
386 return NGX_CONF_OK; | |
387 | |
388 } else if (cf->args->nelts != 2) { | |
389 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
390 "invalid number of the map parameters"); | |
391 return NGX_CONF_ERROR; | |
392 } | |
393 | |
394 if (ngx_strcmp(value[0].data, "include") == 0) { | |
395 file = value[1]; | |
396 | |
3642 | 397 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { |
589 | 398 return NGX_CONF_ERROR; |
399 } | |
400 | |
401 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); | |
402 | |
403 return ngx_conf_parse(cf, &file); | |
404 } | |
405 | |
3792
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
406 if (value[1].data[0] == '$') { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
407 name = value[1]; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
408 name.len--; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
409 name.data++; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
410 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
411 index = ngx_http_get_variable_index(ctx->cf, &name); |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
412 if (index == NGX_ERROR) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
413 return NGX_CONF_ERROR; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
414 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
415 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
416 var = ctx->var_values.elts; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
417 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
418 for (i = 0; i < ctx->var_values.nelts; i++) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
419 if (index == (ngx_int_t) var[i].data) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
420 goto found; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
421 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
422 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
423 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
424 var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t)); |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
425 if (var == NULL) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
426 return NGX_CONF_ERROR; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
427 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
428 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
429 var->valid = 0; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
430 var->no_cacheable = 0; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
431 var->not_found = 0; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
432 var->len = 0; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
433 var->data = (u_char *) index; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
434 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
435 vp = ngx_array_push(&ctx->var_values); |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
436 if (vp == NULL) { |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
437 return NGX_CONF_ERROR; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
438 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
439 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
440 *vp = var; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
441 |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
442 goto found; |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
443 } |
164a7f8df979
allow variable as "map" value
Igor Sysoev <igor@sysoev.ru>
parents:
3791
diff
changeset
|
444 |
589 | 445 key = 0; |
446 | |
447 for (i = 0; i < value[1].len; i++) { | |
448 key = ngx_hash(key, value[1].data[i]); | |
449 } | |
450 | |
593 | 451 key %= ctx->keys.hsize; |
589 | 452 |
453 vp = ctx->values_hash[key].elts; | |
454 | |
455 if (vp) { | |
456 for (i = 0; i < ctx->values_hash[key].nelts; i++) { | |
457 if (value[1].len != (size_t) vp[i]->len) { | |
458 continue; | |
459 } | |
460 | |
461 if (ngx_strncmp(value[1].data, vp[i]->data, value[1].len) == 0) { | |
462 var = vp[i]; | |
463 goto found; | |
464 } | |
465 } | |
466 | |
467 } else { | |
468 if (ngx_array_init(&ctx->values_hash[key], cf->pool, 4, | |
469 sizeof(ngx_http_variable_value_t *)) | |
470 != NGX_OK) | |
471 { | |
472 return NGX_CONF_ERROR; | |
473 } | |
474 } | |
475 | |
593 | 476 var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t)); |
589 | 477 if (var == NULL) { |
478 return NGX_CONF_ERROR; | |
479 } | |
480 | |
481 var->len = value[1].len; | |
593 | 482 var->data = ngx_pstrdup(ctx->keys.pool, &value[1]); |
589 | 483 if (var->data == NULL) { |
484 return NGX_CONF_ERROR; | |
485 } | |
486 | |
487 var->valid = 1; | |
1565 | 488 var->no_cacheable = 0; |
589 | 489 var->not_found = 0; |
490 | |
491 vp = ngx_array_push(&ctx->values_hash[key]); | |
492 if (vp == NULL) { | |
493 return NGX_CONF_ERROR; | |
494 } | |
495 | |
496 *vp = var; | |
497 | |
498 found: | |
499 | |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
500 if (ngx_strcmp(value[0].data, "default") == 0) { |
589 | 501 |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
502 if (ctx->default_value) { |
589 | 503 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
504 "duplicate default map parameter"); |
589 | 505 return NGX_CONF_ERROR; |
506 } | |
507 | |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
508 ctx->default_value = var; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
509 |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
510 return NGX_CONF_OK; |
589 | 511 } |
512 | |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
513 #if (NGX_PCRE) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
514 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
515 if (value[0].len && value[0].data[0] == '~') { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
516 ngx_regex_compile_t rc; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
517 ngx_http_map_regex_t *regex; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
518 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
519 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
520 regex = ngx_array_push(&ctx->regexes); |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
521 if (regex == NULL) { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
522 return NGX_CONF_ERROR; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
523 } |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
524 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
525 value[0].len--; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
526 value[0].data++; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
527 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
528 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
529 |
3930
ace14fd91086
revert r3875 since now map uses case sensetive regexes by default
Igor Sysoev <igor@sysoev.ru>
parents:
3929
diff
changeset
|
530 if (value[0].data[0] == '*') { |
ace14fd91086
revert r3875 since now map uses case sensetive regexes by default
Igor Sysoev <igor@sysoev.ru>
parents:
3929
diff
changeset
|
531 value[0].len--; |
ace14fd91086
revert r3875 since now map uses case sensetive regexes by default
Igor Sysoev <igor@sysoev.ru>
parents:
3929
diff
changeset
|
532 value[0].data++; |
ace14fd91086
revert r3875 since now map uses case sensetive regexes by default
Igor Sysoev <igor@sysoev.ru>
parents:
3929
diff
changeset
|
533 rc.options = NGX_REGEX_CASELESS; |
ace14fd91086
revert r3875 since now map uses case sensetive regexes by default
Igor Sysoev <igor@sysoev.ru>
parents:
3929
diff
changeset
|
534 } |
ace14fd91086
revert r3875 since now map uses case sensetive regexes by default
Igor Sysoev <igor@sysoev.ru>
parents:
3929
diff
changeset
|
535 |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
536 rc.pattern = value[0]; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
537 rc.err.len = NGX_MAX_CONF_ERRSTR; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
538 rc.err.data = errstr; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
539 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
540 regex->regex = ngx_http_regex_compile(ctx->cf, &rc); |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
541 if (regex->regex == NULL) { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
542 return NGX_CONF_ERROR; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
543 } |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
544 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
545 regex->value = var; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
546 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
547 return NGX_CONF_OK; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
548 } |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
549 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
550 #endif |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3792
diff
changeset
|
551 |
3791
11701c4c0358
use "\" to escape "default", "include", and "hostnames" values instead of "!"
Igor Sysoev <igor@sysoev.ru>
parents:
3790
diff
changeset
|
552 if (value[0].len && value[0].data[0] == '\\') { |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
553 value[0].len--; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
554 value[0].data++; |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
555 } |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
556 |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
557 rc = ngx_hash_add_key(&ctx->keys, &value[0], var, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
558 (ctx->hostnames) ? NGX_HASH_WILDCARD_KEY : 0); |
589 | 559 |
591 | 560 if (rc == NGX_OK) { |
561 return NGX_CONF_OK; | |
562 } | |
589 | 563 |
1253
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
564 if (rc == NGX_DECLINED) { |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
565 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
566 "invalid hostname or wildcard \"%V\"", &value[0]); |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
567 } |
8ef04207c84f
the "www.example.*" wildcard hash support
Igor Sysoev <igor@sysoev.ru>
parents:
797
diff
changeset
|
568 |
591 | 569 if (rc == NGX_BUSY) { |
570 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
571 "conflicting parameter \"%V\"", &value[0]); | |
572 } | |
589 | 573 |
591 | 574 return NGX_CONF_ERROR; |
589 | 575 } |