comparison src/http/ngx_http.c @ 326:9fc4ab6673f9 NGINX_0_6_7

nginx 0.6.7 *) Change: now the paths specified in the "include", "auth_basic_user_file", "perl_modules", "ssl_certificate", "ssl_certificate_key", and "ssl_client_certificate" directives are relative to directory of nginx configuration file nginx.conf, but not to nginx prefix directory. *) Change: the --sysconfdir=PATH option in configure was canceled. *) Change: the special make target "upgrade1" was defined for online upgrade of 0.1.x versions. *) Feature: the "server_name" and "valid_referers" directives support regular expressions. *) Feature: the "server" directive in the "upstream" context supports the "backup" parameter. *) Feature: the ngx_http_perl_module supports the $r->discard_request_body. *) Feature: the "add_header Last-Modified ..." directive changes the "Last-Modified" response header line. *) Bugfix: if an response different than 200 was returned to an request with body and connection went to the keep-alive state after the request, then nginx returned 400 for the next request. *) Bugfix: a segmentation fault occurred in worker process if invalid address was set in the "auth_http" directive. *) Bugfix: now nginx uses default listen backlog value 511 on all platforms except FreeBSD. Thanks to Jiang Hong. *) Bugfix: a worker process may got caught in an endless loop, if an "server" inside "upstream" block was marked as "down"; bug appeared in 0.6.6. *) Bugfix: now Solaris sendfilev() is not used to transfer the client request body to FastCGI-server via the unix domain socket.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Aug 2007 00:00:00 +0400
parents f7cd062ee035
children 1c519aff5c0c
comparison
equal deleted inserted replaced
325:f395c7a4c8a8 326:9fc4ab6673f9
96 ngx_http_virtual_names_t *vn; 96 ngx_http_virtual_names_t *vn;
97 ngx_http_core_srv_conf_t **cscfp, *cscf; 97 ngx_http_core_srv_conf_t **cscfp, *cscf;
98 ngx_http_core_loc_conf_t *clcf; 98 ngx_http_core_loc_conf_t *clcf;
99 ngx_http_phase_handler_pt checker; 99 ngx_http_phase_handler_pt checker;
100 ngx_http_core_main_conf_t *cmcf; 100 ngx_http_core_main_conf_t *cmcf;
101 #if (NGX_PCRE)
102 ngx_uint_t regex;
103 #endif
101 #if (NGX_WIN32) 104 #if (NGX_WIN32)
102 ngx_iocp_conf_t *iocpcf; 105 ngx_iocp_conf_t *iocpcf;
103 #endif 106 #endif
104 107
105 /* the main http context */ 108 /* the main http context */
653 if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) { 656 if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {
654 ngx_destroy_pool(ha.temp_pool); 657 ngx_destroy_pool(ha.temp_pool);
655 return NGX_CONF_ERROR; 658 return NGX_CONF_ERROR;
656 } 659 }
657 660
661 #if (NGX_PCRE)
662 regex = 0;
663 #endif
664
658 name = in_addr[a].names.elts; 665 name = in_addr[a].names.elts;
659 666
660 for (s = 0; s < in_addr[a].names.nelts; s++) { 667 for (s = 0; s < in_addr[a].names.nelts; s++) {
668
669 #if (NGX_PCRE)
670 if (name[s].regex) {
671 regex++;
672 continue;
673 }
674 #endif
661 675
662 rc = ngx_hash_add_key(&ha, &name[s].name, name[s].core_srv_conf, 676 rc = ngx_hash_add_key(&ha, &name[s].name, name[s].core_srv_conf,
663 NGX_HASH_WILDCARD_KEY); 677 NGX_HASH_WILDCARD_KEY);
664 678
665 if (rc == NGX_ERROR) { 679 if (rc == NGX_ERROR) {
738 752
739 in_addr[a].wc_tail = (ngx_hash_wildcard_t *) hash.hash; 753 in_addr[a].wc_tail = (ngx_hash_wildcard_t *) hash.hash;
740 } 754 }
741 755
742 ngx_destroy_pool(ha.temp_pool); 756 ngx_destroy_pool(ha.temp_pool);
757
758 #if (NGX_PCRE)
759
760 if (regex == 0) {
761 continue;
762 }
763
764 in_addr[a].nregex = regex;
765 in_addr[a].regex = ngx_palloc(cf->pool,
766 regex * sizeof(ngx_http_server_name_t));
767
768 if (in_addr[a].regex == NULL) {
769 return NGX_CONF_ERROR;
770 }
771
772 for (i = 0, s = 0; s < in_addr[a].names.nelts; s++) {
773 if (name[s].regex) {
774 in_addr[a].regex[i++] = name[s];
775 }
776 }
777 #endif
743 } 778 }
744 779
745 in_addr = in_port[p].addrs.elts; 780 in_addr = in_port[p].addrs.elts;
746 last = in_port[p].addrs.nelts; 781 last = in_port[p].addrs.nelts;
747 782
869 if (vn == NULL) { 904 if (vn == NULL) {
870 return NGX_CONF_ERROR; 905 return NGX_CONF_ERROR;
871 } 906 }
872 hip->addrs[i].virtual_names = vn; 907 hip->addrs[i].virtual_names = vn;
873 908
874 vn->hash = in_addr[i].hash; 909 vn->names.hash = in_addr[i].hash;
875 vn->wc_head = in_addr[i].wc_head; 910 vn->names.wc_head = in_addr[i].wc_head;
876 vn->wc_tail = in_addr[i].wc_tail; 911 vn->names.wc_tail = in_addr[i].wc_tail;
912 #if (NGX_PCRE)
913 vn->nregex = in_addr[i].nregex;
914 vn->regex = in_addr[i].regex;
915 #endif
877 } 916 }
878 917
879 if (done) { 918 if (done) {
880 break; 919 break;
881 } 920 }
930 { 969 {
931 ngx_http_conf_in_addr_t *in_addr; 970 ngx_http_conf_in_addr_t *in_addr;
932 971
933 if (in_port->addrs.elts == NULL) { 972 if (in_port->addrs.elts == NULL) {
934 if (ngx_array_init(&in_port->addrs, cf->temp_pool, 4, 973 if (ngx_array_init(&in_port->addrs, cf->temp_pool, 4,
935 sizeof(ngx_http_conf_in_addr_t)) != NGX_OK) 974 sizeof(ngx_http_conf_in_addr_t))
975 != NGX_OK)
936 { 976 {
937 return NGX_ERROR; 977 return NGX_ERROR;
938 } 978 }
939 } 979 }
940 980
947 in_addr->hash.buckets = NULL; 987 in_addr->hash.buckets = NULL;
948 in_addr->hash.size = 0; 988 in_addr->hash.size = 0;
949 in_addr->wc_head = NULL; 989 in_addr->wc_head = NULL;
950 in_addr->wc_tail = NULL; 990 in_addr->wc_tail = NULL;
951 in_addr->names.elts = NULL; 991 in_addr->names.elts = NULL;
992 #if (NGX_PCRE)
993 in_addr->nregex = 0;
994 in_addr->regex = NULL;
995 #endif
952 in_addr->core_srv_conf = cscf; 996 in_addr->core_srv_conf = cscf;
953 in_addr->default_server = lscf->conf.default_server; 997 in_addr->default_server = lscf->conf.default_server;
954 in_addr->bind = lscf->conf.bind; 998 in_addr->bind = lscf->conf.bind;
955 in_addr->listen_conf = &lscf->conf; 999 in_addr->listen_conf = &lscf->conf;
956 1000
979 ngx_uint_t i, n; 1023 ngx_uint_t i, n;
980 ngx_http_server_name_t *server_names, *name; 1024 ngx_http_server_name_t *server_names, *name;
981 1025
982 if (in_addr->names.elts == NULL) { 1026 if (in_addr->names.elts == NULL) {
983 if (ngx_array_init(&in_addr->names, cf->temp_pool, 4, 1027 if (ngx_array_init(&in_addr->names, cf->temp_pool, 4,
984 sizeof(ngx_http_server_name_t)) != NGX_OK) 1028 sizeof(ngx_http_server_name_t))
1029 != NGX_OK)
985 { 1030 {
986 return NGX_ERROR; 1031 return NGX_ERROR;
987 } 1032 }
988 } 1033 }
989 1034
990 server_names = cscf->server_names.elts; 1035 server_names = cscf->server_names.elts;
1036
991 for (i = 0; i < cscf->server_names.nelts; i++) { 1037 for (i = 0; i < cscf->server_names.nelts; i++) {
992 1038
993 for (n = 0; n < server_names[i].name.len; n++) { 1039 for (n = 0; n < server_names[i].name.len; n++) {
994 server_names[i].name.data[n] = 1040 server_names[i].name.data[n] =
995 ngx_tolower(server_names[i].name.data[n]); 1041 ngx_tolower(server_names[i].name.data[n]);
996 } 1042 }
997 1043
998 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, cf->log, 0, 1044 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, cf->log, 0,
999 "name: %V", &server_names[i].name); 1045 "name: %V", &server_names[i].name);
1000
1001 1046
1002 name = ngx_array_push(&in_addr->names); 1047 name = ngx_array_push(&in_addr->names);
1003 if (name == NULL) { 1048 if (name == NULL) {
1004 return NGX_ERROR; 1049 return NGX_ERROR;
1005 } 1050 }