comparison src/http/ngx_http.c @ 70:8ad297c88dcb NGINX_0_1_35

nginx 0.1.35 *) 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; bug 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"; bug appeared in 0.1.28.
author Igor Sysoev <http://sysoev.ru>
date Tue, 07 Jun 2005 00:00:00 +0400
parents b55cbf18157e
children b31656313b59
comparison
equal deleted inserted replaced
69:cce7ea52608c 70:8ad297c88dcb
358 /* 358 /*
359 * create the lists of ports, addresses and server names 359 * create the lists of ports, addresses and server names
360 * to quickly find the server core module configuration at run-time 360 * to quickly find the server core module configuration at run-time
361 */ 361 */
362 362
363 if (ngx_array_init(&in_ports, cf->pool, 10, sizeof(ngx_http_in_port_t)) 363 if (ngx_array_init(&in_ports, cf->pool, 2, sizeof(ngx_http_in_port_t))
364 != NGX_OK) 364 != NGX_OK)
365 { 365 {
366 return NGX_CONF_ERROR; 366 return NGX_CONF_ERROR;
367 } 367 }
368 368
432 432
433 inaddr = ngx_array_push(&in_port[p].addrs); 433 inaddr = ngx_array_push(&in_port[p].addrs);
434 if (inaddr == NULL) { 434 if (inaddr == NULL) {
435 return NGX_CONF_ERROR; 435 return NGX_CONF_ERROR;
436 } 436 }
437 in_addr = in_port[p].addrs.elts;
437 438
438 /* 439 /*
439 * the INADDR_ANY must be the last resort 440 * the INADDR_ANY must be the last resort
440 * so we move it to the end of the address list 441 * so we move it to the end of the address list
441 * and put the new address in its place 442 * and put the new address in its place
576 if (in_addr[a].hash == NULL) { 577 if (in_addr[a].hash == NULL) {
577 return NGX_CONF_ERROR; 578 return NGX_CONF_ERROR;
578 } 579 }
579 580
580 for (n = 0; n < cmcf->server_names_hash; n++) { 581 for (n = 0; n < cmcf->server_names_hash; n++) {
581 if (ngx_array_init(&in_addr[a].hash[n], cf->pool, 5, 582 if (ngx_array_init(&in_addr[a].hash[n], cf->pool, 4,
582 sizeof(ngx_http_server_name_t)) != NGX_OK) 583 sizeof(ngx_http_server_name_t)) != NGX_OK)
583 { 584 {
584 return NGX_CONF_ERROR; 585 return NGX_CONF_ERROR;
585 } 586 }
586 } 587 }
593 594
594 s_name = ngx_array_push(&in_addr[a].hash[key]); 595 s_name = ngx_array_push(&in_addr[a].hash[key]);
595 if (s_name == NULL) { 596 if (s_name == NULL) {
596 return NGX_CONF_ERROR; 597 return NGX_CONF_ERROR;
597 } 598 }
599 name = in_addr[a].names.elts;
598 600
599 *s_name = name[s]; 601 *s_name = name[s];
600 } 602 }
601 } 603 }
602 } 604 }
746 ngx_http_listen_t *lscf, ngx_http_core_srv_conf_t *cscf) 748 ngx_http_listen_t *lscf, ngx_http_core_srv_conf_t *cscf)
747 { 749 {
748 ngx_http_in_addr_t *in_addr; 750 ngx_http_in_addr_t *in_addr;
749 751
750 if (in_port->addrs.elts == NULL) { 752 if (in_port->addrs.elts == NULL) {
751 if (ngx_array_init(&in_port->addrs, cf->pool, 10, 753 if (ngx_array_init(&in_port->addrs, cf->pool, 4,
752 sizeof(ngx_http_in_addr_t)) != NGX_OK) 754 sizeof(ngx_http_in_addr_t)) != NGX_OK)
753 { 755 {
754 return NGX_ERROR; 756 return NGX_ERROR;
755 } 757 }
756 } 758 }
792 ngx_uint_t i, n; 794 ngx_uint_t i, n;
793 ngx_array_t *array; 795 ngx_array_t *array;
794 ngx_http_server_name_t *server_names, *name; 796 ngx_http_server_name_t *server_names, *name;
795 797
796 if (in_addr->names.elts == NULL) { 798 if (in_addr->names.elts == NULL) {
797 if (ngx_array_init(&in_addr->names, cf->pool, 10, 799 if (ngx_array_init(&in_addr->names, cf->pool, 4,
798 sizeof(ngx_http_server_name_t)) != NGX_OK) 800 sizeof(ngx_http_server_name_t)) != NGX_OK)
799 { 801 {
800 return NGX_ERROR; 802 return NGX_ERROR;
801 } 803 }
802 } 804 }
803 805
804 if (in_addr->wildcards.elts == NULL) { 806 if (in_addr->wildcards.elts == NULL) {
805 if (ngx_array_init(&in_addr->wildcards, cf->pool, 10, 807 if (ngx_array_init(&in_addr->wildcards, cf->pool, 1,
806 sizeof(ngx_http_server_name_t)) != NGX_OK) 808 sizeof(ngx_http_server_name_t)) != NGX_OK)
807 { 809 {
808 return NGX_ERROR; 810 return NGX_ERROR;
809 } 811 }
810 } 812 }
832 834
833 name = ngx_array_push(array); 835 name = ngx_array_push(array);
834 if (name == NULL) { 836 if (name == NULL) {
835 return NGX_ERROR; 837 return NGX_ERROR;
836 } 838 }
839 server_names = cscf->server_names.elts;
837 840
838 *name = server_names[i]; 841 *name = server_names[i];
839 } 842 }
840 843
841 return NGX_OK; 844 return NGX_OK;