diff 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
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -6,7 +6,11 @@
 
 
 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-
+static char *ngx_http_merge_locations(ngx_conf_t *cf,
+                                      ngx_array_t *locations,
+                                      void **loc_conf,
+                                      ngx_http_module_t *module,
+                                      ngx_uint_t ctx_index);
 
 int         ngx_http_max_module;
 
@@ -204,7 +208,16 @@ static char *ngx_http_block(ngx_conf_t *
 
                 /* merge the locations{}' loc_conf's */
 
-                clcfp = (ngx_http_core_loc_conf_t **)cscfp[s]->locations.elts;
+                rv = ngx_http_merge_locations(cf, &cscfp[s]->locations,
+                                              cscfp[s]->ctx->loc_conf,
+                                              module, mi);
+                if (rv != NGX_CONF_OK) {
+                    *cf = pcf;
+                    return rv;
+                }
+
+#if 0
+                clcfp = (ngx_http_core_loc_conf_t **) cscfp[s]->locations.elts;
 
                 for (l = 0; l < cscfp[s]->locations.nelts; l++) {
                     rv = module->merge_loc_conf(cf,
@@ -215,6 +228,7 @@ static char *ngx_http_block(ngx_conf_t *
                         return rv;
                     }
                 }
+#endif
             }
         }
     }
@@ -623,3 +637,33 @@ static char *ngx_http_block(ngx_conf_t *
 
     return NGX_CONF_OK;
 }
+
+
+static char *ngx_http_merge_locations(ngx_conf_t *cf,
+                                      ngx_array_t *locations,
+                                      void **loc_conf,
+                                      ngx_http_module_t *module,
+                                      ngx_uint_t ctx_index)
+{
+    char                       *rv;
+    ngx_uint_t                  i;
+    ngx_http_core_loc_conf_t  **clcfp;
+
+    clcfp = /* (ngx_http_core_loc_conf_t **) */ locations->elts;
+
+    for (i = 0; i < locations->nelts; i++) {
+        rv = module->merge_loc_conf(cf, loc_conf[ctx_index],
+                                    clcfp[i]->loc_conf[ctx_index]);
+        if (rv != NGX_CONF_OK) {
+            return rv;
+        }
+
+        rv = ngx_http_merge_locations(cf, &clcfp[i]->locations,
+                                      clcfp[i]->loc_conf, module, ctx_index);
+        if (rv != NGX_CONF_OK) {
+            return rv;
+        }
+    }
+
+    return NGX_CONF_OK;
+}