Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 54:27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 28 Jan 2003 15:56:37 +0000 |
parents | f1ee46c036a4 |
children | cad6c2f43283 |
comparison
equal
deleted
inserted
replaced
53:d1e42f1b8fd4 | 54:27b628ef907e |
---|---|
119 cf->ctx = prev; | 119 cf->ctx = prev; |
120 | 120 |
121 if (rv != NGX_CONF_OK) | 121 if (rv != NGX_CONF_OK) |
122 return rv; | 122 return rv; |
123 | 123 |
124 | |
125 #if 0 | |
126 /* DEBUG STUFF */ | |
127 cscf = (ngx_http_core_srv_conf_t **) ngx_http_servers.elts; | |
128 for (s = 0; s < ngx_http_servers.nelts; s++) { | |
129 ngx_http_core_loc_conf_t **loc; | |
130 | |
131 ngx_log_debug(cf->log, "srv: %08x" _ cscf[s]); | |
132 loc = (ngx_http_core_loc_conf_t **) cscf[s]->locations.elts; | |
133 for (l = 0; l < cscf[s]->locations.nelts; l++) { | |
134 ngx_log_debug(cf->log, "loc: %08x:%s, %08x:%s" _ | |
135 loc[l] _ loc[l]->name.data _ | |
136 &loc[l]->doc_root _ loc[l]->doc_root.data); | |
137 } | |
138 } | |
139 /**/ | |
140 #endif | |
141 | |
124 ngx_init_array(ngx_http_index_handlers, | 142 ngx_init_array(ngx_http_index_handlers, |
125 cf->pool, 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR); | 143 cf->pool, 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR); |
126 | 144 |
127 ngx_http_init_filters(cf->pool, ngx_modules); | 145 ngx_http_init_filters(cf->pool, ngx_modules); |
128 | 146 |
129 #if 1 | 147 /* create lists of ports, addresses and server names */ |
148 | |
130 ngx_init_array(in_ports, cf->pool, 10, sizeof(ngx_http_in_port_t), | 149 ngx_init_array(in_ports, cf->pool, 10, sizeof(ngx_http_in_port_t), |
131 NGX_CONF_ERROR); | 150 NGX_CONF_ERROR); |
132 | 151 |
133 cscf = (ngx_http_core_srv_conf_t **) ngx_http_servers.elts; | 152 cscf = (ngx_http_core_srv_conf_t **) ngx_http_servers.elts; |
134 for (s = 0; s < ngx_http_servers.nelts; s++) { | 153 for (s = 0; s < ngx_http_servers.nelts; s++) { |
231 | 250 |
232 ngx_init_array(in_port->addr, cf->pool, 10, | 251 ngx_init_array(in_port->addr, cf->pool, 10, |
233 sizeof(ngx_http_in_addr_t), | 252 sizeof(ngx_http_in_addr_t), |
234 NGX_CONF_ERROR); | 253 NGX_CONF_ERROR); |
235 | 254 |
236 ngx_test_null(inaddr, ngx_push_array(&in_port[p].addr), | 255 ngx_test_null(inaddr, ngx_push_array(&in_port->addr), |
237 NGX_CONF_ERROR); | 256 NGX_CONF_ERROR); |
238 | 257 |
239 inaddr->addr = lscf[l].addr; | 258 inaddr->addr = lscf[l].addr; |
240 inaddr->flags = lscf[l].flags; | 259 inaddr->flags = lscf[l].flags; |
241 inaddr->core_srv_conf = cscf[s]; | 260 inaddr->core_srv_conf = cscf[s]; |
244 sizeof(ngx_http_server_name_t), | 263 sizeof(ngx_http_server_name_t), |
245 NGX_CONF_ERROR); | 264 NGX_CONF_ERROR); |
246 } | 265 } |
247 } | 266 } |
248 } | 267 } |
268 | |
269 /* optimzie lists of ports, addresses and server names */ | |
249 | 270 |
250 /* AF_INET only */ | 271 /* AF_INET only */ |
251 | 272 |
252 in_port = (ngx_http_in_port_t *) in_ports.elts; | 273 in_port = (ngx_http_in_port_t *) in_ports.elts; |
253 for (p = 0; p < in_ports.nelts; p++) { | 274 for (p = 0; p < in_ports.nelts; p++) { |
328 ls->servers = &in_port[p].addr; | 349 ls->servers = &in_port[p].addr; |
329 | 350 |
330 if (in_port[p].addr.nelts == 1) { | 351 if (in_port[p].addr.nelts == 1) { |
331 in_addr = (ngx_http_in_addr_t *) in_port[p].addr.elts; | 352 in_addr = (ngx_http_in_addr_t *) in_port[p].addr.elts; |
332 | 353 |
354 /* if there is the single address for this port and no virtual | |
355 name servers so we do not need to check addresses | |
356 at run time */ | |
333 if (in_addr[a].names.nelts == 0) { | 357 if (in_addr[a].names.nelts == 0) { |
334 ls->ctx = in_addr->core_srv_conf->ctx; | 358 ls->ctx = in_addr->core_srv_conf->ctx; |
335 ls->servers = NULL; | 359 ls->servers = NULL; |
336 } | 360 } |
337 } | 361 } |
362 ngx_log_debug(cf->log, "ls ctx: %d:%08x" _ in_port[p].port _ ls->ctx); | |
338 } | 363 } |
339 } | 364 } |
340 #endif | |
341 | 365 |
342 return NGX_CONF_OK; | 366 return NGX_CONF_OK; |
343 } | 367 } |
344 | 368 |
345 | 369 |