0
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
|
4 */
|
|
5
|
|
6
|
|
7 #include <ngx_config.h>
|
|
8 #include <ngx_core.h>
|
|
9 #include <ngx_event.h>
|
|
10 #include <ngx_http.h>
|
|
11
|
|
12
|
|
13 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
4
|
14 static ngx_int_t ngx_http_add_address(ngx_conf_t *cf,
|
142
|
15 ngx_http_conf_in_port_t *in_port, ngx_http_listen_t *lscf,
|
48
|
16 ngx_http_core_srv_conf_t *cscf);
|
4
|
17 static ngx_int_t ngx_http_add_names(ngx_conf_t *cf,
|
142
|
18 ngx_http_conf_in_addr_t *in_addr, ngx_http_core_srv_conf_t *cscf);
|
0
|
19 static char *ngx_http_merge_locations(ngx_conf_t *cf,
|
48
|
20 ngx_array_t *locations, void **loc_conf, ngx_http_module_t *module,
|
|
21 ngx_uint_t ctx_index);
|
372
|
22 static ngx_int_t ngx_http_cmp_conf_in_addrs(const void *one, const void *two);
|
142
|
23 static int ngx_libc_cdecl ngx_http_cmp_dns_wildcards(const void *one,
|
|
24 const void *two);
|
0
|
25
|
142
|
26 ngx_uint_t ngx_http_max_module;
|
|
27
|
|
28 ngx_uint_t ngx_http_total_requests;
|
|
29 uint64_t ngx_http_total_sent;
|
0
|
30
|
|
31
|
|
32 ngx_int_t (*ngx_http_top_header_filter) (ngx_http_request_t *r);
|
|
33 ngx_int_t (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
|
|
34
|
|
35
|
|
36 static ngx_command_t ngx_http_commands[] = {
|
|
37
|
48
|
38 { ngx_string("http"),
|
|
39 NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
|
40 ngx_http_block,
|
|
41 0,
|
|
42 0,
|
|
43 NULL },
|
0
|
44
|
48
|
45 ngx_null_command
|
0
|
46 };
|
|
47
|
126
|
48
|
0
|
49 static ngx_core_module_t ngx_http_module_ctx = {
|
|
50 ngx_string("http"),
|
|
51 NULL,
|
|
52 NULL
|
126
|
53 };
|
0
|
54
|
|
55
|
|
56 ngx_module_t ngx_http_module = {
|
58
|
57 NGX_MODULE_V1,
|
0
|
58 &ngx_http_module_ctx, /* module context */
|
|
59 ngx_http_commands, /* module directives */
|
|
60 NGX_CORE_MODULE, /* module type */
|
90
|
61 NULL, /* init master */
|
0
|
62 NULL, /* init module */
|
90
|
63 NULL, /* init process */
|
|
64 NULL, /* init thread */
|
|
65 NULL, /* exit thread */
|
|
66 NULL, /* exit process */
|
|
67 NULL, /* exit master */
|
|
68 NGX_MODULE_V1_PADDING
|
0
|
69 };
|
|
70
|
|
71
|
48
|
72 static char *
|
|
73 ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
0
|
74 {
|
|
75 char *rv;
|
230
|
76 ngx_int_t rc, j;
|
|
77 ngx_uint_t mi, m, s, l, p, a, i, n;
|
|
78 ngx_uint_t find_config_index, use_rewrite, use_access;
|
142
|
79 ngx_uint_t last, bind_all, done;
|
0
|
80 ngx_conf_t pcf;
|
198
|
81 ngx_array_t headers_in, in_ports;
|
|
82 ngx_hash_key_t *hk;
|
142
|
83 ngx_hash_init_t hash;
|
0
|
84 ngx_listening_t *ls;
|
|
85 ngx_http_listen_t *lscf;
|
|
86 ngx_http_module_t *module;
|
198
|
87 ngx_http_header_t *header;
|
142
|
88 ngx_http_in_port_t *hip;
|
0
|
89 ngx_http_handler_pt *h;
|
|
90 ngx_http_conf_ctx_t *ctx;
|
142
|
91 ngx_http_conf_in_port_t *in_port;
|
|
92 ngx_http_conf_in_addr_t *in_addr;
|
|
93 ngx_hash_keys_arrays_t ha;
|
|
94 ngx_http_server_name_t *name;
|
230
|
95 ngx_http_phase_handler_t *ph;
|
142
|
96 ngx_http_virtual_names_t *vn;
|
0
|
97 ngx_http_core_srv_conf_t **cscfp, *cscf;
|
|
98 ngx_http_core_loc_conf_t *clcf;
|
230
|
99 ngx_http_phase_handler_pt checker;
|
0
|
100 ngx_http_core_main_conf_t *cmcf;
|
326
|
101 #if (NGX_PCRE)
|
|
102 ngx_uint_t regex;
|
|
103 #endif
|
0
|
104
|
|
105 /* the main http context */
|
26
|
106
|
50
|
107 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
|
|
108 if (ctx == NULL) {
|
34
|
109 return NGX_CONF_ERROR;
|
|
110 }
|
0
|
111
|
|
112 *(ngx_http_conf_ctx_t **) conf = ctx;
|
|
113
|
34
|
114
|
0
|
115 /* count the number of the http modules and set up their indices */
|
|
116
|
|
117 ngx_http_max_module = 0;
|
|
118 for (m = 0; ngx_modules[m]; m++) {
|
|
119 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
|
120 continue;
|
|
121 }
|
|
122
|
|
123 ngx_modules[m]->ctx_index = ngx_http_max_module++;
|
|
124 }
|
|
125
|
26
|
126
|
34
|
127 /* the http main_conf context, it is the same in the all http contexts */
|
0
|
128
|
34
|
129 ctx->main_conf = ngx_pcalloc(cf->pool,
|
|
130 sizeof(void *) * ngx_http_max_module);
|
|
131 if (ctx->main_conf == NULL) {
|
|
132 return NGX_CONF_ERROR;
|
|
133 }
|
0
|
134
|
|
135
|
34
|
136 /*
|
|
137 * the http null srv_conf context, it is used to merge
|
|
138 * the server{}s' srv_conf's
|
|
139 */
|
|
140
|
|
141 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
|
|
142 if (ctx->srv_conf == NULL) {
|
|
143 return NGX_CONF_ERROR;
|
|
144 }
|
|
145
|
|
146
|
|
147 /*
|
|
148 * the http null loc_conf context, it is used to merge
|
|
149 * the server{}s' loc_conf's
|
|
150 */
|
|
151
|
|
152 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
|
|
153 if (ctx->loc_conf == NULL) {
|
|
154 return NGX_CONF_ERROR;
|
|
155 }
|
|
156
|
|
157
|
|
158 /*
|
|
159 * create the main_conf's, the null srv_conf's, and the null loc_conf's
|
|
160 * of the all http modules
|
|
161 */
|
0
|
162
|
|
163 for (m = 0; ngx_modules[m]; m++) {
|
|
164 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
|
165 continue;
|
|
166 }
|
|
167
|
|
168 module = ngx_modules[m]->ctx;
|
|
169 mi = ngx_modules[m]->ctx_index;
|
|
170
|
|
171 if (module->create_main_conf) {
|
50
|
172 ctx->main_conf[mi] = module->create_main_conf(cf);
|
|
173 if (ctx->main_conf[mi] == NULL) {
|
34
|
174 return NGX_CONF_ERROR;
|
|
175 }
|
0
|
176 }
|
|
177
|
|
178 if (module->create_srv_conf) {
|
50
|
179 ctx->srv_conf[mi] = module->create_srv_conf(cf);
|
|
180 if (ctx->srv_conf[mi] == NULL) {
|
34
|
181 return NGX_CONF_ERROR;
|
|
182 }
|
0
|
183 }
|
|
184
|
|
185 if (module->create_loc_conf) {
|
50
|
186 ctx->loc_conf[mi] = module->create_loc_conf(cf);
|
|
187 if (ctx->loc_conf[mi] == NULL) {
|
34
|
188 return NGX_CONF_ERROR;
|
|
189 }
|
0
|
190 }
|
|
191 }
|
|
192
|
58
|
193 pcf = *cf;
|
|
194 cf->ctx = ctx;
|
|
195
|
|
196 for (m = 0; ngx_modules[m]; m++) {
|
|
197 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
|
198 continue;
|
|
199 }
|
|
200
|
|
201 module = ngx_modules[m]->ctx;
|
|
202 mi = ngx_modules[m]->ctx_index;
|
|
203
|
|
204 if (module->preconfiguration) {
|
|
205 if (module->preconfiguration(cf) != NGX_OK) {
|
|
206 return NGX_CONF_ERROR;
|
|
207 }
|
|
208 }
|
|
209 }
|
34
|
210
|
0
|
211 /* parse inside the http{} block */
|
|
212
|
|
213 cf->module_type = NGX_HTTP_MODULE;
|
|
214 cf->cmd_type = NGX_HTTP_MAIN_CONF;
|
|
215 rv = ngx_conf_parse(cf, NULL);
|
|
216
|
|
217 if (rv != NGX_CONF_OK) {
|
|
218 *cf = pcf;
|
|
219 return rv;
|
|
220 }
|
|
221
|
|
222 /*
|
|
223 * init http{} main_conf's, merge the server{}s' srv_conf's
|
|
224 * and its location{}s' loc_conf's
|
|
225 */
|
|
226
|
|
227 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
|
|
228 cscfp = cmcf->servers.elts;
|
|
229
|
|
230 for (m = 0; ngx_modules[m]; m++) {
|
|
231 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
|
232 continue;
|
|
233 }
|
|
234
|
|
235 module = ngx_modules[m]->ctx;
|
|
236 mi = ngx_modules[m]->ctx_index;
|
|
237
|
|
238 /* init http{} main_conf's */
|
|
239
|
|
240 if (module->init_main_conf) {
|
|
241 rv = module->init_main_conf(cf, ctx->main_conf[mi]);
|
|
242 if (rv != NGX_CONF_OK) {
|
|
243 *cf = pcf;
|
|
244 return rv;
|
|
245 }
|
|
246 }
|
|
247
|
|
248 for (s = 0; s < cmcf->servers.nelts; s++) {
|
|
249
|
|
250 /* merge the server{}s' srv_conf's */
|
|
251
|
|
252 if (module->merge_srv_conf) {
|
|
253 rv = module->merge_srv_conf(cf,
|
|
254 ctx->srv_conf[mi],
|
|
255 cscfp[s]->ctx->srv_conf[mi]);
|
|
256 if (rv != NGX_CONF_OK) {
|
|
257 *cf = pcf;
|
|
258 return rv;
|
|
259 }
|
|
260 }
|
|
261
|
|
262 if (module->merge_loc_conf) {
|
|
263
|
|
264 /* merge the server{}'s loc_conf */
|
|
265
|
|
266 rv = module->merge_loc_conf(cf,
|
|
267 ctx->loc_conf[mi],
|
|
268 cscfp[s]->ctx->loc_conf[mi]);
|
|
269 if (rv != NGX_CONF_OK) {
|
|
270 *cf = pcf;
|
|
271 return rv;
|
|
272 }
|
|
273
|
|
274 /* merge the locations{}' loc_conf's */
|
|
275
|
|
276 rv = ngx_http_merge_locations(cf, &cscfp[s]->locations,
|
|
277 cscfp[s]->ctx->loc_conf,
|
|
278 module, mi);
|
|
279 if (rv != NGX_CONF_OK) {
|
|
280 *cf = pcf;
|
|
281 return rv;
|
|
282 }
|
|
283 }
|
|
284 }
|
|
285 }
|
|
286
|
34
|
287
|
0
|
288 /* init lists of the handlers */
|
|
289
|
122
|
290 if (ngx_array_init(&cmcf->phases[NGX_HTTP_POST_READ_PHASE].handlers,
|
|
291 cf->pool, 1, sizeof(ngx_http_handler_pt))
|
|
292 != NGX_OK)
|
34
|
293 {
|
|
294 return NGX_CONF_ERROR;
|
|
295 }
|
|
296
|
122
|
297
|
|
298 if (ngx_array_init(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers,
|
|
299 cf->pool, 1, sizeof(ngx_http_handler_pt))
|
|
300 != NGX_OK)
|
|
301 {
|
|
302 return NGX_CONF_ERROR;
|
|
303 }
|
|
304
|
0
|
305
|
122
|
306 if (ngx_array_init(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers,
|
|
307 cf->pool, 1, sizeof(ngx_http_handler_pt))
|
|
308 != NGX_OK)
|
|
309 {
|
|
310 return NGX_CONF_ERROR;
|
|
311 }
|
|
312
|
|
313
|
130
|
314 if (ngx_array_init(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers,
|
|
315 cf->pool, 1, sizeof(ngx_http_handler_pt))
|
|
316 != NGX_OK)
|
|
317 {
|
|
318 return NGX_CONF_ERROR;
|
|
319 }
|
|
320
|
|
321
|
34
|
322 if (ngx_array_init(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers,
|
130
|
323 cf->pool, 2, sizeof(ngx_http_handler_pt))
|
122
|
324 != NGX_OK)
|
34
|
325 {
|
|
326 return NGX_CONF_ERROR;
|
|
327 }
|
|
328
|
0
|
329
|
34
|
330 if (ngx_array_init(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers,
|
122
|
331 cf->pool, 4, sizeof(ngx_http_handler_pt))
|
|
332 != NGX_OK)
|
34
|
333 {
|
|
334 return NGX_CONF_ERROR;
|
|
335 }
|
|
336
|
0
|
337
|
130
|
338 if (ngx_array_init(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers,
|
|
339 cf->pool, 1, sizeof(ngx_http_handler_pt))
|
|
340 != NGX_OK)
|
|
341 {
|
|
342 return NGX_CONF_ERROR;
|
|
343 }
|
|
344
|
|
345
|
198
|
346 if (ngx_array_init(&headers_in, cf->temp_pool, 32, sizeof(ngx_hash_key_t))
|
56
|
347 != NGX_OK)
|
|
348 {
|
|
349 return NGX_CONF_ERROR;
|
|
350 }
|
|
351
|
198
|
352 for (header = ngx_http_headers_in; header->name.len; header++) {
|
|
353 hk = ngx_array_push(&headers_in);
|
|
354 if (hk == NULL) {
|
|
355 return NGX_CONF_ERROR;
|
|
356 }
|
|
357
|
|
358 hk->key = header->name;
|
|
359 hk->key_hash = ngx_hash_key_lc(header->name.data, header->name.len);
|
|
360 hk->value = header;
|
|
361 }
|
|
362
|
|
363 hash.hash = &cmcf->headers_in_hash;
|
|
364 hash.key = ngx_hash_key_lc;
|
|
365 hash.max_size = 512;
|
244
|
366 hash.bucket_size = ngx_align(64, ngx_cacheline_size);
|
198
|
367 hash.name = "headers_in_hash";
|
|
368 hash.pool = cf->pool;
|
|
369 hash.temp_pool = NULL;
|
|
370
|
|
371 if (ngx_hash_init(&hash, headers_in.elts, headers_in.nelts) != NGX_OK) {
|
|
372 return NGX_CONF_ERROR;
|
|
373 }
|
|
374
|
58
|
375
|
|
376 for (m = 0; ngx_modules[m]; m++) {
|
|
377 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
|
378 continue;
|
|
379 }
|
|
380
|
|
381 module = ngx_modules[m]->ctx;
|
|
382 mi = ngx_modules[m]->ctx_index;
|
|
383
|
|
384 if (module->postconfiguration) {
|
|
385 if (module->postconfiguration(cf) != NGX_OK) {
|
|
386 return NGX_CONF_ERROR;
|
|
387 }
|
|
388 }
|
|
389 }
|
|
390
|
122
|
391 if (ngx_http_variables_init_vars(cf) != NGX_OK) {
|
|
392 return NGX_CONF_ERROR;
|
|
393 }
|
58
|
394
|
|
395 /*
|
|
396 * http{}'s cf->ctx was needed while the configuration merging
|
|
397 * and in postconfiguration process
|
|
398 */
|
|
399
|
|
400 *cf = pcf;
|
|
401
|
56
|
402
|
230
|
403 cmcf->phase_engine.server_rewrite_index = (ngx_uint_t) -1;
|
324
|
404 cmcf->phase_engine.location_rewrite_index = (ngx_uint_t) -1;
|
230
|
405 find_config_index = 0;
|
|
406 use_rewrite = cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers.nelts ? 1 : 0;
|
|
407 use_access = cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers.nelts ? 1 : 0;
|
|
408
|
384
|
409 n = use_rewrite + use_access + cmcf->try_files + 1 /* find config phase */;
|
230
|
410
|
|
411 for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) {
|
|
412 n += cmcf->phases[i].handlers.nelts;
|
|
413 }
|
|
414
|
|
415 ph = ngx_pcalloc(cf->pool,
|
|
416 n * sizeof(ngx_http_phase_handler_t) + sizeof(void *));
|
|
417 if (ph == NULL) {
|
|
418 return NGX_CONF_ERROR;
|
|
419 }
|
|
420
|
|
421 cmcf->phase_engine.handlers = ph;
|
|
422 n = 0;
|
|
423
|
|
424 for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) {
|
|
425 h = cmcf->phases[i].handlers.elts;
|
|
426
|
|
427 switch (i) {
|
|
428
|
|
429 case NGX_HTTP_SERVER_REWRITE_PHASE:
|
|
430 if (cmcf->phase_engine.server_rewrite_index == (ngx_uint_t) -1) {
|
|
431 cmcf->phase_engine.server_rewrite_index = n;
|
|
432 }
|
|
433 checker = ngx_http_core_generic_phase;
|
|
434
|
|
435 break;
|
|
436
|
|
437 case NGX_HTTP_FIND_CONFIG_PHASE:
|
|
438 find_config_index = n;
|
|
439
|
|
440 ph->checker = ngx_http_core_find_config_phase;
|
|
441 n++;
|
|
442 ph++;
|
|
443
|
|
444 continue;
|
|
445
|
324
|
446 case NGX_HTTP_REWRITE_PHASE:
|
|
447 if (cmcf->phase_engine.location_rewrite_index == (ngx_uint_t) -1) {
|
|
448 cmcf->phase_engine.location_rewrite_index = n;
|
|
449 }
|
|
450 checker = ngx_http_core_generic_phase;
|
|
451
|
|
452 break;
|
|
453
|
230
|
454 case NGX_HTTP_POST_REWRITE_PHASE:
|
|
455 if (use_rewrite) {
|
|
456 ph->checker = ngx_http_core_post_rewrite_phase;
|
|
457 ph->next = find_config_index;
|
|
458 n++;
|
|
459 ph++;
|
|
460 }
|
|
461
|
|
462 continue;
|
|
463
|
|
464 case NGX_HTTP_ACCESS_PHASE:
|
|
465 checker = ngx_http_core_access_phase;
|
|
466 n++;
|
|
467 break;
|
|
468
|
|
469 case NGX_HTTP_POST_ACCESS_PHASE:
|
|
470 if (use_access) {
|
|
471 ph->checker = ngx_http_core_post_access_phase;
|
|
472 ph->next = n;
|
|
473 ph++;
|
|
474 }
|
|
475
|
|
476 continue;
|
|
477
|
384
|
478 case NGX_HTTP_TRY_FILES_PHASE:
|
|
479 if (cmcf->try_files) {
|
|
480 ph->checker = ngx_http_core_try_files_phase;
|
|
481 n++;
|
|
482 ph++;
|
|
483 }
|
|
484
|
|
485 continue;
|
|
486
|
230
|
487 case NGX_HTTP_CONTENT_PHASE:
|
|
488 checker = ngx_http_core_content_phase;
|
|
489 break;
|
|
490
|
|
491 default:
|
|
492 checker = ngx_http_core_generic_phase;
|
|
493 }
|
|
494
|
|
495 n += cmcf->phases[i].handlers.nelts;
|
|
496
|
|
497 for (j = cmcf->phases[i].handlers.nelts - 1; j >=0; j--) {
|
|
498 ph->checker = checker;
|
|
499 ph->handler = h[j];
|
|
500 ph->next = n;
|
|
501 ph++;
|
|
502 }
|
|
503 }
|
|
504
|
|
505
|
0
|
506 /*
|
4
|
507 * create the lists of ports, addresses and server names
|
|
508 * to quickly find the server core module configuration at run-time
|
0
|
509 */
|
|
510
|
142
|
511 if (ngx_array_init(&in_ports, cf->temp_pool, 2,
|
|
512 sizeof(ngx_http_conf_in_port_t))
|
50
|
513 != NGX_OK)
|
4
|
514 {
|
|
515 return NGX_CONF_ERROR;
|
|
516 }
|
0
|
517
|
|
518 /* "server" directives */
|
4
|
519
|
0
|
520 cscfp = cmcf->servers.elts;
|
|
521 for (s = 0; s < cmcf->servers.nelts; s++) {
|
|
522
|
|
523 /* "listen" directives */
|
4
|
524
|
0
|
525 lscf = cscfp[s]->listen.elts;
|
|
526 for (l = 0; l < cscfp[s]->listen.nelts; l++) {
|
|
527
|
|
528 /* AF_INET only */
|
|
529
|
|
530 in_port = in_ports.elts;
|
|
531 for (p = 0; p < in_ports.nelts; p++) {
|
|
532
|
142
|
533 if (lscf[l].port != in_port[p].port) {
|
|
534 continue;
|
|
535 }
|
0
|
536
|
142
|
537 /* the port is already in the port list */
|
0
|
538
|
142
|
539 in_addr = in_port[p].addrs.elts;
|
|
540 for (a = 0; a < in_port[p].addrs.nelts; a++) {
|
0
|
541
|
142
|
542 if (lscf[l].addr != in_addr[a].addr) {
|
|
543 continue;
|
|
544 }
|
0
|
545
|
142
|
546 /* the address is already in the address list */
|
0
|
547
|
142
|
548 if (ngx_http_add_names(cf, &in_addr[a], cscfp[s]) != NGX_OK)
|
|
549 {
|
|
550 return NGX_CONF_ERROR;
|
|
551 }
|
0
|
552
|
142
|
553 /*
|
|
554 * check the duplicate "default" server
|
|
555 * for this address:port
|
|
556 */
|
0
|
557
|
142
|
558 if (lscf[l].conf.default_server) {
|
4
|
559
|
142
|
560 if (in_addr[a].default_server) {
|
|
561 ngx_log_error(NGX_LOG_ERR, cf->log, 0,
|
336
|
562 "the duplicate default server in %s:%ui",
|
366
|
563 lscf[l].file_name, lscf[l].line);
|
0
|
564
|
142
|
565 return NGX_CONF_ERROR;
|
|
566 }
|
4
|
567
|
142
|
568 in_addr[a].core_srv_conf = cscfp[s];
|
|
569 in_addr[a].default_server = 1;
|
380
|
570 in_addr[a].listen_conf = &lscf[l].conf;
|
0
|
571 }
|
|
572
|
142
|
573 goto found;
|
4
|
574 }
|
0
|
575
|
142
|
576 /*
|
|
577 * add the address to the addresses list that
|
|
578 * bound to this port
|
|
579 */
|
0
|
580
|
142
|
581 if (ngx_http_add_address(cf, &in_port[p], &lscf[l], cscfp[s])
|
50
|
582 != NGX_OK)
|
4
|
583 {
|
|
584 return NGX_CONF_ERROR;
|
|
585 }
|
142
|
586
|
|
587 goto found;
|
0
|
588 }
|
142
|
589
|
|
590 /* add the port to the in_port list */
|
|
591
|
|
592 in_port = ngx_array_push(&in_ports);
|
|
593 if (in_port == NULL) {
|
|
594 return NGX_CONF_ERROR;
|
|
595 }
|
|
596
|
|
597 in_port->port = lscf[l].port;
|
|
598 in_port->addrs.elts = NULL;
|
|
599
|
|
600 if (ngx_http_add_address(cf, in_port, &lscf[l], cscfp[s]) != NGX_OK)
|
|
601 {
|
|
602 return NGX_CONF_ERROR;
|
|
603 }
|
|
604
|
|
605 found:
|
|
606
|
|
607 continue;
|
0
|
608 }
|
|
609 }
|
|
610
|
4
|
611
|
|
612 /* optimize the lists of ports, addresses and server names */
|
0
|
613
|
|
614 /* AF_INET only */
|
|
615
|
|
616 in_port = in_ports.elts;
|
|
617 for (p = 0; p < in_ports.nelts; p++) {
|
|
618
|
302
|
619 ngx_sort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
|
|
620 sizeof(ngx_http_conf_in_addr_t), ngx_http_cmp_conf_in_addrs);
|
72
|
621
|
4
|
622 /*
|
|
623 * check whether all name-based servers have the same configuraiton
|
152
|
624 * as the default server,
|
158
|
625 * or some servers disable optimizing the server names
|
4
|
626 */
|
0
|
627
|
|
628 in_addr = in_port[p].addrs.elts;
|
|
629 for (a = 0; a < in_port[p].addrs.nelts; a++) {
|
|
630
|
|
631 name = in_addr[a].names.elts;
|
152
|
632 for (s = 0; s < in_addr[a].names.nelts; s++) {
|
|
633
|
|
634 if (in_addr[a].core_srv_conf != name[s].core_srv_conf
|
162
|
635 || name[s].core_srv_conf->optimize_server_names == 0)
|
4
|
636 {
|
142
|
637 goto virtual_names;
|
26
|
638 }
|
|
639 }
|
|
640
|
0
|
641 /*
|
4
|
642 * if all name-based servers have the same configuration
|
152
|
643 * as the default server,
|
158
|
644 * and no servers disable optimizing the server names
|
4
|
645 * then we do not need to check them at run-time at all
|
0
|
646 */
|
|
647
|
142
|
648 in_addr[a].names.nelts = 0;
|
|
649
|
|
650 continue;
|
|
651
|
|
652 virtual_names:
|
|
653
|
168
|
654 ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
|
|
655
|
142
|
656 ha.temp_pool = ngx_create_pool(16384, cf->log);
|
|
657 if (ha.temp_pool == NULL) {
|
|
658 return NGX_CONF_ERROR;
|
26
|
659 }
|
|
660
|
142
|
661 ha.pool = cf->pool;
|
26
|
662
|
142
|
663 if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
|
|
664 ngx_destroy_pool(ha.temp_pool);
|
|
665 return NGX_CONF_ERROR;
|
|
666 }
|
26
|
667
|
326
|
668 #if (NGX_PCRE)
|
|
669 regex = 0;
|
|
670 #endif
|
|
671
|
142
|
672 name = in_addr[a].names.elts;
|
312
|
673
|
142
|
674 for (s = 0; s < in_addr[a].names.nelts; s++) {
|
26
|
675
|
326
|
676 #if (NGX_PCRE)
|
|
677 if (name[s].regex) {
|
|
678 regex++;
|
|
679 continue;
|
|
680 }
|
|
681 #endif
|
|
682
|
142
|
683 rc = ngx_hash_add_key(&ha, &name[s].name, name[s].core_srv_conf,
|
312
|
684 NGX_HASH_WILDCARD_KEY);
|
142
|
685
|
|
686 if (rc == NGX_ERROR) {
|
26
|
687 return NGX_CONF_ERROR;
|
|
688 }
|
|
689
|
312
|
690 if (rc == NGX_DECLINED) {
|
|
691 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
|
692 "invalid server name or wildcard \"%V\" on %s",
|
180
|
693 &name[s].name, in_addr[a].listen_conf->addr);
|
142
|
694 return NGX_CONF_ERROR;
|
26
|
695 }
|
|
696
|
142
|
697 if (rc == NGX_BUSY) {
|
|
698 ngx_log_error(NGX_LOG_WARN, cf->log, 0,
|
180
|
699 "conflicting server name \"%V\" on %s, ignored",
|
|
700 &name[s].name, in_addr[a].listen_conf->addr);
|
142
|
701 }
|
|
702 }
|
26
|
703
|
142
|
704 hash.key = ngx_hash_key_lc;
|
|
705 hash.max_size = cmcf->server_names_hash_max_size;
|
|
706 hash.bucket_size = cmcf->server_names_hash_bucket_size;
|
|
707 hash.name = "server_names_hash";
|
|
708 hash.pool = cf->pool;
|
26
|
709
|
142
|
710 if (ha.keys.nelts) {
|
|
711 hash.hash = &in_addr[a].hash;
|
|
712 hash.temp_pool = NULL;
|
|
713
|
|
714 if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK)
|
|
715 {
|
|
716 ngx_destroy_pool(ha.temp_pool);
|
|
717 return NGX_CONF_ERROR;
|
26
|
718 }
|
0
|
719 }
|
142
|
720
|
312
|
721 if (ha.dns_wc_head.nelts) {
|
142
|
722
|
312
|
723 ngx_qsort(ha.dns_wc_head.elts,
|
|
724 (size_t) ha.dns_wc_head.nelts,
|
142
|
725 sizeof(ngx_hash_key_t),
|
|
726 ngx_http_cmp_dns_wildcards);
|
|
727
|
|
728 hash.hash = NULL;
|
|
729 hash.temp_pool = ha.temp_pool;
|
|
730
|
312
|
731 if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,
|
|
732 ha.dns_wc_head.nelts)
|
142
|
733 != NGX_OK)
|
|
734 {
|
|
735 ngx_destroy_pool(ha.temp_pool);
|
|
736 return NGX_CONF_ERROR;
|
|
737 }
|
|
738
|
312
|
739 in_addr[a].wc_head = (ngx_hash_wildcard_t *) hash.hash;
|
|
740 }
|
|
741
|
|
742 if (ha.dns_wc_tail.nelts) {
|
|
743
|
|
744 ngx_qsort(ha.dns_wc_tail.elts,
|
|
745 (size_t) ha.dns_wc_tail.nelts,
|
|
746 sizeof(ngx_hash_key_t),
|
|
747 ngx_http_cmp_dns_wildcards);
|
|
748
|
|
749 hash.hash = NULL;
|
|
750 hash.temp_pool = ha.temp_pool;
|
|
751
|
|
752 if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,
|
|
753 ha.dns_wc_tail.nelts)
|
|
754 != NGX_OK)
|
|
755 {
|
|
756 ngx_destroy_pool(ha.temp_pool);
|
|
757 return NGX_CONF_ERROR;
|
|
758 }
|
|
759
|
|
760 in_addr[a].wc_tail = (ngx_hash_wildcard_t *) hash.hash;
|
142
|
761 }
|
|
762
|
|
763 ngx_destroy_pool(ha.temp_pool);
|
326
|
764
|
|
765 #if (NGX_PCRE)
|
|
766
|
|
767 if (regex == 0) {
|
|
768 continue;
|
|
769 }
|
|
770
|
|
771 in_addr[a].nregex = regex;
|
|
772 in_addr[a].regex = ngx_palloc(cf->pool,
|
|
773 regex * sizeof(ngx_http_server_name_t));
|
|
774
|
|
775 if (in_addr[a].regex == NULL) {
|
|
776 return NGX_CONF_ERROR;
|
|
777 }
|
|
778
|
|
779 for (i = 0, s = 0; s < in_addr[a].names.nelts; s++) {
|
|
780 if (name[s].regex) {
|
|
781 in_addr[a].regex[i++] = name[s];
|
|
782 }
|
|
783 }
|
|
784 #endif
|
0
|
785 }
|
|
786
|
142
|
787 in_addr = in_port[p].addrs.elts;
|
|
788 last = in_port[p].addrs.nelts;
|
|
789
|
0
|
790 /*
|
26
|
791 * if there is the binding to the "*:port" then we need to bind()
|
|
792 * to the "*:port" only and ignore the other bindings
|
0
|
793 */
|
|
794
|
142
|
795 if (in_addr[last - 1].addr == INADDR_ANY) {
|
|
796 in_addr[last - 1].bind = 1;
|
|
797 bind_all = 0;
|
0
|
798
|
|
799 } else {
|
142
|
800 bind_all = 1;
|
0
|
801 }
|
|
802
|
142
|
803 for (a = 0; a < last; /* void */ ) {
|
|
804
|
|
805 if (!bind_all && !in_addr[a].bind) {
|
|
806 a++;
|
|
807 continue;
|
|
808 }
|
0
|
809
|
|
810 ls = ngx_listening_inet_stream_socket(cf, in_addr[a].addr,
|
|
811 in_port[p].port);
|
|
812 if (ls == NULL) {
|
|
813 return NGX_CONF_ERROR;
|
|
814 }
|
|
815
|
|
816 ls->addr_ntop = 1;
|
|
817
|
|
818 ls->handler = ngx_http_init_connection;
|
|
819
|
|
820 cscf = in_addr[a].core_srv_conf;
|
|
821 ls->pool_size = cscf->connection_pool_size;
|
72
|
822 ls->post_accept_timeout = cscf->client_header_timeout;
|
0
|
823
|
|
824 clcf = cscf->ctx->loc_conf[ngx_http_core_module.ctx_index];
|
92
|
825
|
|
826 ls->log = *clcf->err_log;
|
|
827 ls->log.data = &ls->addr_text;
|
|
828 ls->log.handler = ngx_accept_log_error;
|
0
|
829
|
10
|
830 #if (NGX_WIN32)
|
356
|
831 {
|
|
832 ngx_iocp_conf_t *iocpcf;
|
|
833
|
0
|
834 iocpcf = ngx_event_get_conf(cf->cycle->conf_ctx, ngx_iocp_module);
|
|
835 if (iocpcf->acceptex_read) {
|
|
836 ls->post_accept_buffer_size = cscf->client_header_buffer_size;
|
|
837 }
|
356
|
838 }
|
0
|
839 #endif
|
|
840
|
142
|
841 ls->backlog = in_addr[a].listen_conf->backlog;
|
|
842 ls->rcvbuf = in_addr[a].listen_conf->rcvbuf;
|
|
843 ls->sndbuf = in_addr[a].listen_conf->sndbuf;
|
72
|
844
|
|
845 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
|
142
|
846 ls->accept_filter = in_addr[a].listen_conf->accept_filter;
|
72
|
847 #endif
|
|
848
|
|
849 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
|
142
|
850 ls->deferred_accept = in_addr[a].listen_conf->deferred_accept;
|
72
|
851 #endif
|
|
852
|
142
|
853 hip = ngx_palloc(cf->pool, sizeof(ngx_http_in_port_t));
|
|
854 if (hip == NULL) {
|
|
855 return NGX_CONF_ERROR;
|
|
856 }
|
0
|
857
|
142
|
858 hip->port = in_port[p].port;
|
|
859
|
|
860 hip->port_text.data = ngx_palloc(cf->pool, 7);
|
|
861 if (hip->port_text.data == NULL) {
|
|
862 return NGX_CONF_ERROR;
|
|
863 }
|
0
|
864
|
142
|
865 ls->servers = hip;
|
|
866
|
|
867 hip->port_text.len = ngx_sprintf(hip->port_text.data, ":%d",
|
|
868 hip->port)
|
|
869 - hip->port_text.data;
|
0
|
870
|
142
|
871 in_addr = in_port[p].addrs.elts;
|
0
|
872
|
142
|
873 if (in_addr[a].bind && in_addr[a].addr != INADDR_ANY) {
|
|
874 hip->naddrs = 1;
|
|
875 done = 0;
|
0
|
876
|
142
|
877 } else if (in_port[p].addrs.nelts > 1
|
|
878 && in_addr[last - 1].addr == INADDR_ANY)
|
|
879 {
|
|
880 hip->naddrs = last;
|
|
881 done = 1;
|
0
|
882
|
142
|
883 } else {
|
|
884 hip->naddrs = 1;
|
|
885 done = 0;
|
|
886 }
|
0
|
887
|
142
|
888 #if 0
|
|
889 ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
|
890 "%ui: %V %d %ui %ui",
|
|
891 a, &ls->addr_text, in_addr[a].bind,
|
|
892 hip->naddrs, last);
|
|
893 #endif
|
0
|
894
|
142
|
895 hip->addrs = ngx_pcalloc(cf->pool,
|
|
896 hip->naddrs * sizeof(ngx_http_in_addr_t));
|
|
897 if (hip->addrs == NULL) {
|
|
898 return NGX_CONF_ERROR;
|
|
899 }
|
0
|
900
|
142
|
901 for (i = 0; i < hip->naddrs; i++) {
|
|
902 hip->addrs[i].addr = in_addr[i].addr;
|
|
903 hip->addrs[i].core_srv_conf = in_addr[i].core_srv_conf;
|
0
|
904
|
142
|
905 if (in_addr[i].hash.buckets == NULL
|
312
|
906 && (in_addr[i].wc_head == NULL
|
|
907 || in_addr[i].wc_head->hash.buckets == NULL)
|
384
|
908 && (in_addr[i].wc_tail == NULL
|
|
909 || in_addr[i].wc_tail->hash.buckets == NULL))
|
142
|
910 {
|
0
|
911 continue;
|
|
912 }
|
142
|
913
|
|
914 vn = ngx_palloc(cf->pool, sizeof(ngx_http_virtual_names_t));
|
|
915 if (vn == NULL) {
|
|
916 return NGX_CONF_ERROR;
|
|
917 }
|
|
918 hip->addrs[i].virtual_names = vn;
|
|
919
|
326
|
920 vn->names.hash = in_addr[i].hash;
|
|
921 vn->names.wc_head = in_addr[i].wc_head;
|
|
922 vn->names.wc_tail = in_addr[i].wc_tail;
|
|
923 #if (NGX_PCRE)
|
|
924 vn->nregex = in_addr[i].nregex;
|
|
925 vn->regex = in_addr[i].regex;
|
|
926 #endif
|
0
|
927 }
|
|
928
|
142
|
929 if (done) {
|
|
930 break;
|
|
931 }
|
|
932
|
|
933 in_addr++;
|
|
934 in_port[p].addrs.elts = in_addr;
|
|
935 last--;
|
|
936
|
|
937 a = 0;
|
0
|
938 }
|
|
939 }
|
|
940
|
138
|
941 #if 0
|
4
|
942 {
|
|
943 u_char address[20];
|
138
|
944 ngx_uint_t p, a;
|
4
|
945
|
0
|
946 in_port = in_ports.elts;
|
|
947 for (p = 0; p < in_ports.nelts; p++) {
|
|
948 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cf->log, 0,
|
10
|
949 "port: %d %p", in_port[p].port, &in_port[p]);
|
0
|
950 in_addr = in_port[p].addrs.elts;
|
|
951 for (a = 0; a < in_port[p].addrs.nelts; a++) {
|
4
|
952 ngx_inet_ntop(AF_INET, &in_addr[a].addr, address, 20);
|
|
953 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, cf->log, 0,
|
10
|
954 "%s:%d %p",
|
4
|
955 address, in_port[p].port, in_addr[a].core_srv_conf);
|
142
|
956 name = in_addr[a].names.elts;
|
0
|
957 for (n = 0; n < in_addr[a].names.nelts; n++) {
|
4
|
958 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, cf->log, 0,
|
10
|
959 "%s:%d %V %p",
|
142
|
960 address, in_port[p].port, &name[n].name,
|
|
961 name[n].core_srv_conf);
|
0
|
962 }
|
|
963 }
|
|
964 }
|
4
|
965 }
|
0
|
966 #endif
|
|
967
|
|
968 return NGX_CONF_OK;
|
|
969 }
|
|
970
|
|
971
|
4
|
972 /*
|
|
973 * add the server address, the server names and the server core module
|
|
974 * configurations to the port (in_port)
|
|
975 */
|
|
976
|
48
|
977 static ngx_int_t
|
142
|
978 ngx_http_add_address(ngx_conf_t *cf, ngx_http_conf_in_port_t *in_port,
|
48
|
979 ngx_http_listen_t *lscf, ngx_http_core_srv_conf_t *cscf)
|
4
|
980 {
|
142
|
981 ngx_http_conf_in_addr_t *in_addr;
|
4
|
982
|
|
983 if (in_port->addrs.elts == NULL) {
|
142
|
984 if (ngx_array_init(&in_port->addrs, cf->temp_pool, 4,
|
326
|
985 sizeof(ngx_http_conf_in_addr_t))
|
|
986 != NGX_OK)
|
4
|
987 {
|
|
988 return NGX_ERROR;
|
|
989 }
|
|
990 }
|
|
991
|
50
|
992 in_addr = ngx_array_push(&in_port->addrs);
|
|
993 if (in_addr == NULL) {
|
4
|
994 return NGX_ERROR;
|
|
995 }
|
|
996
|
|
997 in_addr->addr = lscf->addr;
|
142
|
998 in_addr->hash.buckets = NULL;
|
|
999 in_addr->hash.size = 0;
|
312
|
1000 in_addr->wc_head = NULL;
|
|
1001 in_addr->wc_tail = NULL;
|
4
|
1002 in_addr->names.elts = NULL;
|
326
|
1003 #if (NGX_PCRE)
|
|
1004 in_addr->nregex = 0;
|
|
1005 in_addr->regex = NULL;
|
|
1006 #endif
|
4
|
1007 in_addr->core_srv_conf = cscf;
|
142
|
1008 in_addr->default_server = lscf->conf.default_server;
|
|
1009 in_addr->bind = lscf->conf.bind;
|
|
1010 in_addr->listen_conf = &lscf->conf;
|
4
|
1011
|
|
1012 #if (NGX_DEBUG)
|
|
1013 {
|
|
1014 u_char text[20];
|
|
1015 ngx_inet_ntop(AF_INET, &in_addr->addr, text, 20);
|
|
1016 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cf->log, 0, "address: %s:%d",
|
|
1017 text, in_port->port);
|
|
1018 }
|
|
1019 #endif
|
|
1020
|
|
1021 return ngx_http_add_names(cf, in_addr, cscf);
|
|
1022 }
|
|
1023
|
|
1024
|
|
1025 /*
|
|
1026 * add the server names and the server core module
|
|
1027 * configurations to the address:port (in_addr)
|
|
1028 */
|
|
1029
|
48
|
1030 static ngx_int_t
|
142
|
1031 ngx_http_add_names(ngx_conf_t *cf, ngx_http_conf_in_addr_t *in_addr,
|
48
|
1032 ngx_http_core_srv_conf_t *cscf)
|
4
|
1033 {
|
26
|
1034 ngx_uint_t i, n;
|
4
|
1035 ngx_http_server_name_t *server_names, *name;
|
|
1036
|
|
1037 if (in_addr->names.elts == NULL) {
|
142
|
1038 if (ngx_array_init(&in_addr->names, cf->temp_pool, 4,
|
326
|
1039 sizeof(ngx_http_server_name_t))
|
|
1040 != NGX_OK)
|
26
|
1041 {
|
|
1042 return NGX_ERROR;
|
|
1043 }
|
|
1044 }
|
|
1045
|
4
|
1046 server_names = cscf->server_names.elts;
|
326
|
1047
|
4
|
1048 for (i = 0; i < cscf->server_names.nelts; i++) {
|
|
1049
|
26
|
1050 for (n = 0; n < server_names[i].name.len; n++) {
|
|
1051 server_names[i].name.data[n] =
|
|
1052 ngx_tolower(server_names[i].name.data[n]);
|
|
1053 }
|
|
1054
|
4
|
1055 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, cf->log, 0,
|
10
|
1056 "name: %V", &server_names[i].name);
|
4
|
1057
|
142
|
1058 name = ngx_array_push(&in_addr->names);
|
50
|
1059 if (name == NULL) {
|
4
|
1060 return NGX_ERROR;
|
|
1061 }
|
|
1062
|
|
1063 *name = server_names[i];
|
|
1064 }
|
|
1065
|
|
1066 return NGX_OK;
|
|
1067 }
|
|
1068
|
|
1069
|
48
|
1070 static char *
|
|
1071 ngx_http_merge_locations(ngx_conf_t *cf, ngx_array_t *locations,
|
|
1072 void **loc_conf, ngx_http_module_t *module, ngx_uint_t ctx_index)
|
0
|
1073 {
|
|
1074 char *rv;
|
|
1075 ngx_uint_t i;
|
|
1076 ngx_http_core_loc_conf_t **clcfp;
|
|
1077
|
142
|
1078 clcfp = locations->elts;
|
0
|
1079
|
|
1080 for (i = 0; i < locations->nelts; i++) {
|
|
1081 rv = module->merge_loc_conf(cf, loc_conf[ctx_index],
|
|
1082 clcfp[i]->loc_conf[ctx_index]);
|
|
1083 if (rv != NGX_CONF_OK) {
|
|
1084 return rv;
|
|
1085 }
|
|
1086
|
308
|
1087 if (clcfp[i]->locations == NULL) {
|
|
1088 continue;
|
|
1089 }
|
|
1090
|
|
1091 rv = ngx_http_merge_locations(cf, clcfp[i]->locations,
|
0
|
1092 clcfp[i]->loc_conf, module, ctx_index);
|
|
1093 if (rv != NGX_CONF_OK) {
|
|
1094 return rv;
|
|
1095 }
|
|
1096 }
|
|
1097
|
|
1098 return NGX_CONF_OK;
|
|
1099 }
|
142
|
1100
|
|
1101
|
372
|
1102 static ngx_int_t
|
142
|
1103 ngx_http_cmp_conf_in_addrs(const void *one, const void *two)
|
|
1104 {
|
|
1105 ngx_http_conf_in_addr_t *first, *second;
|
|
1106
|
|
1107 first = (ngx_http_conf_in_addr_t *) one;
|
|
1108 second = (ngx_http_conf_in_addr_t *) two;
|
|
1109
|
|
1110 if (first->addr == INADDR_ANY) {
|
|
1111 /* the INADDR_ANY must be the last resort, shift it to the end */
|
|
1112 return 1;
|
|
1113 }
|
|
1114
|
|
1115 if (first->bind && !second->bind) {
|
|
1116 /* shift explicit bind()ed addresses to the start */
|
|
1117 return -1;
|
|
1118 }
|
|
1119
|
|
1120 if (!first->bind && second->bind) {
|
|
1121 /* shift explicit bind()ed addresses to the start */
|
|
1122 return 1;
|
|
1123 }
|
|
1124
|
|
1125 /* do not sort by default */
|
|
1126
|
|
1127 return 0;
|
|
1128 }
|
|
1129
|
|
1130
|
|
1131 static int ngx_libc_cdecl
|
|
1132 ngx_http_cmp_dns_wildcards(const void *one, const void *two)
|
|
1133 {
|
|
1134 ngx_hash_key_t *first, *second;
|
|
1135
|
|
1136 first = (ngx_hash_key_t *) one;
|
|
1137 second = (ngx_hash_key_t *) two;
|
|
1138
|
|
1139 return ngx_strcmp(first->key.data, second->key.data);
|
|
1140 }
|