diff src/http/ngx_http.c @ 521:6f00349b98e5 release-0.1.35

nginx-0.1.35-RELEASE import *) Feature: the "working_directory" directive. *) Feature: the "port_in_redirect" directive. *) Bugfix: the segmentation fault was occurred if the backend response header was in several packets; the bug had appeared in 0.1.29. *) Bugfix: if more than 10 servers were configured or some server did not use the "listen" directive, then the segmentation fault was occurred on the start. *) Bugfix: the segmentation fault might occur if the response was bigger than the temporary file. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com/uri HTTP/1.0"; the bug had appeared in 0.1.28.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 07 Jun 2005 15:56:31 +0000
parents 9b8c906f6e63
children 2019117e6b38
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -360,7 +360,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
      * to quickly find the server core module configuration at run-time
      */
 
-    if (ngx_array_init(&in_ports, cf->pool, 10, sizeof(ngx_http_in_port_t))
+    if (ngx_array_init(&in_ports, cf->pool, 2, sizeof(ngx_http_in_port_t))
         != NGX_OK)
     {
         return NGX_CONF_ERROR;
@@ -434,6 +434,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
                             if (inaddr == NULL) {
                                 return NGX_CONF_ERROR;
                             }
+                            in_addr = in_port[p].addrs.elts;
 
                             /*
                              * the INADDR_ANY must be the last resort
@@ -578,7 +579,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
                 }
 
                 for (n = 0; n < cmcf->server_names_hash; n++) {
-                    if (ngx_array_init(&in_addr[a].hash[n], cf->pool, 5,
+                    if (ngx_array_init(&in_addr[a].hash[n], cf->pool, 4,
                                      sizeof(ngx_http_server_name_t)) != NGX_OK)
                     {
                         return NGX_CONF_ERROR;
@@ -595,6 +596,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
                     if (s_name == NULL) {
                         return NGX_CONF_ERROR;
                     }
+                    name = in_addr[a].names.elts;
 
                     *s_name = name[s];
                 }
@@ -748,7 +750,7 @@ ngx_http_add_address(ngx_conf_t *cf, ngx
     ngx_http_in_addr_t  *in_addr;
 
     if (in_port->addrs.elts == NULL) {
-        if (ngx_array_init(&in_port->addrs, cf->pool, 10,
+        if (ngx_array_init(&in_port->addrs, cf->pool, 4,
                            sizeof(ngx_http_in_addr_t)) != NGX_OK)
         {
             return NGX_ERROR;
@@ -794,7 +796,7 @@ ngx_http_add_names(ngx_conf_t *cf, ngx_h
     ngx_http_server_name_t  *server_names, *name;
 
     if (in_addr->names.elts == NULL) {
-        if (ngx_array_init(&in_addr->names, cf->pool, 10,
+        if (ngx_array_init(&in_addr->names, cf->pool, 4,
                            sizeof(ngx_http_server_name_t)) != NGX_OK)
         {
             return NGX_ERROR;
@@ -802,7 +804,7 @@ ngx_http_add_names(ngx_conf_t *cf, ngx_h
     }
 
     if (in_addr->wildcards.elts == NULL) {
-        if (ngx_array_init(&in_addr->wildcards, cf->pool, 10,
+        if (ngx_array_init(&in_addr->wildcards, cf->pool, 1,
                            sizeof(ngx_http_server_name_t)) != NGX_OK)
         {
             return NGX_ERROR;
@@ -834,6 +836,7 @@ ngx_http_add_names(ngx_conf_t *cf, ngx_h
         if (name == NULL) {
             return NGX_ERROR;
         }
+        server_names = cscf->server_names.elts;
 
         *name = server_names[i];
     }