diff 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
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -121,12 +121,31 @@ static char *ngx_http_block(ngx_conf_t *
     if (rv != NGX_CONF_OK)
         return rv;
 
+
+#if 0
+    /* DEBUG STUFF */
+    cscf = (ngx_http_core_srv_conf_t **) ngx_http_servers.elts;
+    for (s = 0; s < ngx_http_servers.nelts; s++) {
+        ngx_http_core_loc_conf_t **loc;
+
+        ngx_log_debug(cf->log, "srv: %08x" _ cscf[s]);
+        loc = (ngx_http_core_loc_conf_t **) cscf[s]->locations.elts;
+        for (l = 0; l < cscf[s]->locations.nelts; l++) {
+            ngx_log_debug(cf->log, "loc: %08x:%s, %08x:%s" _
+                          loc[l] _ loc[l]->name.data _
+                          &loc[l]->doc_root _ loc[l]->doc_root.data);
+        }
+    }
+    /**/
+#endif
+
     ngx_init_array(ngx_http_index_handlers,
                    cf->pool, 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
 
     ngx_http_init_filters(cf->pool, ngx_modules);
 
-#if 1
+    /* create lists of ports, addresses and server names */
+
     ngx_init_array(in_ports, cf->pool, 10, sizeof(ngx_http_in_port_t),
                    NGX_CONF_ERROR);
 
@@ -233,7 +252,7 @@ static char *ngx_http_block(ngx_conf_t *
                                sizeof(ngx_http_in_addr_t),
                                NGX_CONF_ERROR);
 
-                ngx_test_null(inaddr, ngx_push_array(&in_port[p].addr),
+                ngx_test_null(inaddr, ngx_push_array(&in_port->addr),
                               NGX_CONF_ERROR);
 
                 inaddr->addr = lscf[l].addr;
@@ -247,6 +266,8 @@ static char *ngx_http_block(ngx_conf_t *
         }
     }
 
+    /* optimzie lists of ports, addresses and server names */
+
     /* AF_INET only */
 
     in_port = (ngx_http_in_port_t *) in_ports.elts;
@@ -330,14 +351,17 @@ static char *ngx_http_block(ngx_conf_t *
             if (in_port[p].addr.nelts == 1) {
                 in_addr = (ngx_http_in_addr_t *) in_port[p].addr.elts;
 
+                /* if there is the single address for this port and no virtual
+                   name servers so we do not need to check addresses
+                   at run time */
                 if (in_addr[a].names.nelts == 0) {
                     ls->ctx = in_addr->core_srv_conf->ctx;
                     ls->servers = NULL;
                 }
             }
+ngx_log_debug(cf->log, "ls ctx: %d:%08x" _ in_port[p].port _ ls->ctx);
         }
     }
-#endif
 
     return NGX_CONF_OK;
 }