comparison src/http/ngx_http.c @ 119:cd54bcbaf3b5

nginx-0.0.1-2003-07-21-01:15:59 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 20 Jul 2003 21:15:59 +0000
parents 571bcbff82c5
children 5526213be452
comparison
equal deleted inserted replaced
118:5bf52498665c 119:cd54bcbaf3b5
54 ngx_http_conf_ctx_t *ctx; 54 ngx_http_conf_ctx_t *ctx;
55 ngx_http_in_port_t *in_port, *inport; 55 ngx_http_in_port_t *in_port, *inport;
56 ngx_http_in_addr_t *in_addr, *inaddr; 56 ngx_http_in_addr_t *in_addr, *inaddr;
57 ngx_http_core_main_conf_t *cmcf; 57 ngx_http_core_main_conf_t *cmcf;
58 ngx_http_core_srv_conf_t **cscfp, *cscf; 58 ngx_http_core_srv_conf_t **cscfp, *cscf;
59 ngx_http_core_loc_conf_t **clcfp; 59 ngx_http_core_loc_conf_t **clcfp, *clcf;
60 ngx_http_listen_t *lscf; 60 ngx_http_listen_t *lscf;
61 ngx_http_server_name_t *s_name, *name; 61 ngx_http_server_name_t *s_name, *name;
62 #if (WIN32) 62 #if (WIN32)
63 ngx_iocp_conf_t *iocpcf; 63 ngx_iocp_conf_t *iocpcf;
64 #endif 64 #endif
106 106
107 module = ngx_modules[m]->ctx; 107 module = ngx_modules[m]->ctx;
108 mi = ngx_modules[m]->ctx_index; 108 mi = ngx_modules[m]->ctx_index;
109 109
110 if (module->create_main_conf) { 110 if (module->create_main_conf) {
111 ngx_test_null(ctx->main_conf[mi], 111 ngx_test_null(ctx->main_conf[mi], module->create_main_conf(cf),
112 module->create_main_conf(cf->pool),
113 NGX_CONF_ERROR); 112 NGX_CONF_ERROR);
114 } 113 }
115 114
116 if (module->create_srv_conf) { 115 if (module->create_srv_conf) {
117 ngx_test_null(ctx->srv_conf[mi], 116 ngx_test_null(ctx->srv_conf[mi], module->create_srv_conf(cf),
118 module->create_srv_conf(cf->pool),
119 NGX_CONF_ERROR); 117 NGX_CONF_ERROR);
120 } 118 }
121 119
122 if (module->create_loc_conf) { 120 if (module->create_loc_conf) {
123 ngx_test_null(ctx->loc_conf[mi], 121 ngx_test_null(ctx->loc_conf[mi], module->create_loc_conf(cf),
124 module->create_loc_conf(cf->pool),
125 NGX_CONF_ERROR); 122 NGX_CONF_ERROR);
126 } 123 }
127 } 124 }
128 125
129 126
155 mi = ngx_modules[m]->ctx_index; 152 mi = ngx_modules[m]->ctx_index;
156 153
157 /* init http{} main_conf's */ 154 /* init http{} main_conf's */
158 155
159 if (module->init_main_conf) { 156 if (module->init_main_conf) {
160 rv = module->init_main_conf(cf->pool, ctx->main_conf[mi]); 157 rv = module->init_main_conf(cf, ctx->main_conf[mi]);
161 if (rv != NGX_CONF_OK) { 158 if (rv != NGX_CONF_OK) {
162 return rv; 159 return rv;
163 } 160 }
164 } 161 }
165 162
166 for (s = 0; s < cmcf->servers.nelts; s++) { 163 for (s = 0; s < cmcf->servers.nelts; s++) {
167 164
168 /* merge the server{}s' srv_conf's */ 165 /* merge the server{}s' srv_conf's */
169 166
170 if (module->merge_srv_conf) { 167 if (module->merge_srv_conf) {
171 rv = module->merge_srv_conf(cf->pool, 168 rv = module->merge_srv_conf(cf,
172 ctx->srv_conf[mi], 169 ctx->srv_conf[mi],
173 cscfp[s]->ctx->srv_conf[mi]); 170 cscfp[s]->ctx->srv_conf[mi]);
174 if (rv != NGX_CONF_OK) { 171 if (rv != NGX_CONF_OK) {
175 return rv; 172 return rv;
176 } 173 }
178 175
179 if (module->merge_loc_conf) { 176 if (module->merge_loc_conf) {
180 177
181 /* merge the server{}'s loc_conf */ 178 /* merge the server{}'s loc_conf */
182 179
183 rv = module->merge_loc_conf(cf->pool, 180 rv = module->merge_loc_conf(cf,
184 ctx->loc_conf[mi], 181 ctx->loc_conf[mi],
185 cscfp[s]->ctx->loc_conf[mi]); 182 cscfp[s]->ctx->loc_conf[mi]);
186 if (rv != NGX_CONF_OK) { 183 if (rv != NGX_CONF_OK) {
187 return rv; 184 return rv;
188 } 185 }
190 /* merge the locations{}' loc_conf's */ 187 /* merge the locations{}' loc_conf's */
191 188
192 clcfp = (ngx_http_core_loc_conf_t **)cscfp[s]->locations.elts; 189 clcfp = (ngx_http_core_loc_conf_t **)cscfp[s]->locations.elts;
193 190
194 for (l = 0; l < cscfp[s]->locations.nelts; l++) { 191 for (l = 0; l < cscfp[s]->locations.nelts; l++) {
195 rv = module->merge_loc_conf(cf->pool, 192 rv = module->merge_loc_conf(cf,
196 cscfp[s]->ctx->loc_conf[mi], 193 cscfp[s]->ctx->loc_conf[mi],
197 clcfp[l]->loc_conf[mi]); 194 clcfp[l]->loc_conf[mi]);
198 if (rv != NGX_CONF_OK) { 195 if (rv != NGX_CONF_OK) {
199 return rv; 196 return rv;
200 } 197 }
462 ls->addr_text_max_len = INET_ADDRSTRLEN; 459 ls->addr_text_max_len = INET_ADDRSTRLEN;
463 ls->backlog = -1; 460 ls->backlog = -1;
464 ls->nonblocking = 1; 461 ls->nonblocking = 1;
465 462
466 ls->handler = ngx_http_init_connection; 463 ls->handler = ngx_http_init_connection;
464
465 #if 0
467 ls->log = cf->cycle->log; 466 ls->log = cf->cycle->log;
467 #endif
468 468
469 cscf = in_addr[a].core_srv_conf; 469 cscf = in_addr[a].core_srv_conf;
470 ls->pool_size = cscf->connection_pool_size; 470 ls->pool_size = cscf->connection_pool_size;
471 ls->post_accept_timeout = cscf->post_accept_timeout; 471 ls->post_accept_timeout = cscf->post_accept_timeout;
472
473 clcf = cscf->ctx->loc_conf[ngx_http_core_module.ctx_index];
474 ls->log = clcf->err_log;
472 475
473 #if (WIN32) 476 #if (WIN32)
474 iocpcf = ngx_event_get_conf(cf->cycle->conf_ctx, ngx_iocp_module); 477 iocpcf = ngx_event_get_conf(cf->cycle->conf_ctx, ngx_iocp_module);
475 if (iocpcf->acceptex_read) { 478 if (iocpcf->acceptex_read) {
476 ls->post_accept_buffer_size = cscf->client_header_buffer_size; 479 ls->post_accept_buffer_size = cscf->client_header_buffer_size;