comparison src/http/ngx_http.c @ 396:6f3b20c1ac50

nginx-0.0.7-2004-07-18-23:11:20 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 18 Jul 2004 19:11:20 +0000
parents 15c84a40e87d
children b32ca005e025
comparison
equal deleted inserted replaced
395:f8f0f1834266 396:6f3b20c1ac50
4 #include <ngx_event.h> 4 #include <ngx_event.h>
5 #include <ngx_http.h> 5 #include <ngx_http.h>
6 6
7 7
8 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 8 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
9 9 static char *ngx_http_merge_locations(ngx_conf_t *cf,
10 ngx_array_t *locations,
11 void **loc_conf,
12 ngx_http_module_t *module,
13 ngx_uint_t ctx_index);
10 14
11 int ngx_http_max_module; 15 int ngx_http_max_module;
12 16
13 ngx_uint_t ngx_http_total_requests; 17 ngx_uint_t ngx_http_total_requests;
14 uint64_t ngx_http_total_sent; 18 uint64_t ngx_http_total_sent;
202 return rv; 206 return rv;
203 } 207 }
204 208
205 /* merge the locations{}' loc_conf's */ 209 /* merge the locations{}' loc_conf's */
206 210
207 clcfp = (ngx_http_core_loc_conf_t **)cscfp[s]->locations.elts; 211 rv = ngx_http_merge_locations(cf, &cscfp[s]->locations,
212 cscfp[s]->ctx->loc_conf,
213 module, mi);
214 if (rv != NGX_CONF_OK) {
215 *cf = pcf;
216 return rv;
217 }
218
219 #if 0
220 clcfp = (ngx_http_core_loc_conf_t **) cscfp[s]->locations.elts;
208 221
209 for (l = 0; l < cscfp[s]->locations.nelts; l++) { 222 for (l = 0; l < cscfp[s]->locations.nelts; l++) {
210 rv = module->merge_loc_conf(cf, 223 rv = module->merge_loc_conf(cf,
211 cscfp[s]->ctx->loc_conf[mi], 224 cscfp[s]->ctx->loc_conf[mi],
212 clcfp[l]->loc_conf[mi]); 225 clcfp[l]->loc_conf[mi]);
213 if (rv != NGX_CONF_OK) { 226 if (rv != NGX_CONF_OK) {
214 *cf = pcf; 227 *cf = pcf;
215 return rv; 228 return rv;
216 } 229 }
217 } 230 }
231 #endif
218 } 232 }
219 } 233 }
220 } 234 }
221 235
222 /* we needed "http"'s cf->ctx while merging configuration */ 236 /* we needed "http"'s cf->ctx while merging configuration */
621 } 635 }
622 #endif 636 #endif
623 637
624 return NGX_CONF_OK; 638 return NGX_CONF_OK;
625 } 639 }
640
641
642 static char *ngx_http_merge_locations(ngx_conf_t *cf,
643 ngx_array_t *locations,
644 void **loc_conf,
645 ngx_http_module_t *module,
646 ngx_uint_t ctx_index)
647 {
648 char *rv;
649 ngx_uint_t i;
650 ngx_http_core_loc_conf_t **clcfp;
651
652 clcfp = /* (ngx_http_core_loc_conf_t **) */ locations->elts;
653
654 for (i = 0; i < locations->nelts; i++) {
655 rv = module->merge_loc_conf(cf, loc_conf[ctx_index],
656 clcfp[i]->loc_conf[ctx_index]);
657 if (rv != NGX_CONF_OK) {
658 return rv;
659 }
660
661 rv = ngx_http_merge_locations(cf, &clcfp[i]->locations,
662 clcfp[i]->loc_conf, module, ctx_index);
663 if (rv != NGX_CONF_OK) {
664 return rv;
665 }
666 }
667
668 return NGX_CONF_OK;
669 }