diff src/http/ngx_http.c @ 152:396dbbc06dd7 NGINX_0_3_23

nginx 0.3.23 *) Feature: the "optimize_host_names" directive. *) Bugfix: in using of the variables in the "path" and "alias" directives. *) Bugfix: the ngx_http_perl_module was incorrectly built on Linux and Solaris.
author Igor Sysoev <http://sysoev.ru>
date Tue, 24 Jan 2006 00:00:00 +0300
parents e1c6ac408b68
children 2d15b82126ed
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -76,7 +76,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
     char                        *rv;
     u_char                       ch;
     ngx_int_t                    rc;
-    ngx_uint_t                   mi, m, s, l, p, a, n, i;
+    ngx_uint_t                   mi, m, s, l, p, a, i;
     ngx_uint_t                   last, bind_all, done;
     ngx_conf_t                   pcf;
     ngx_array_t                  in_ports;
@@ -533,16 +533,20 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
 
         /*
          * check whether all name-based servers have the same configuraiton
-         * as the default server, or some servers restrict the host names
+         *     as the default server,
+         * or some servers restrict the host names,
+         * or some servers disable optimizing the host names
          */
 
         in_addr = in_port[p].addrs.elts;
         for (a = 0; a < in_port[p].addrs.nelts; a++) {
 
             name = in_addr[a].names.elts;
-            for (n = 0; n < in_addr[a].names.nelts; n++) {
-                if (in_addr[a].core_srv_conf != name[n].core_srv_conf
-                    || name[n].core_srv_conf->restrict_host_names
+            for (s = 0; s < in_addr[a].names.nelts; s++) {
+
+                if (in_addr[a].core_srv_conf != name[s].core_srv_conf
+                    || name[s].core_srv_conf->optimize_host_names == 0
+                    || name[s].core_srv_conf->restrict_host_names
                        != NGX_HTTP_RESTRICT_HOST_OFF)
                 {
                     goto virtual_names;
@@ -551,7 +555,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
 
             /*
              * if all name-based servers have the same configuration
-             * as the default server, and no servers restrict the host names
+             *         as the default server,
+             *     and no servers restrict the host names,
+             *     and no servers disable optimizing the host names
              * then we do not need to check them at run-time at all
              */